层列表忽略&LT;尺寸和GT;标签 [英] Layer List ignore <size> tag
本文介绍了层列表忽略&LT;尺寸和GT;标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个自定义的单选按钮。
I want to create a custom Radio Button.
我用&LT使用;选择&GT;
和&LT;层列表&gt;
来显示在大圈小圈当用户选择它。
I using with <selector>
and <layer-list>
to show small circle on large circle, when the user select it.
但它似乎忽略&LT;尺寸和GT; <!/ code>标记完全
But it seems to ignore the <size>
tag completely!
我的code是波纹管:
My code is bellow:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false">
<shape>
<size android:width="40dp" android:height="40dp"></size>
<corners android:radius="5dp"></corners>
<solid android:color="@color/blue"/>
</shape>
</item>
<item android:state_checked="true">
<layer-list>
<item>
<shape>
<size android:width="40dp" android:height="40dp"/>
<corners android:radius="5dp"/>
<solid android:color="@color/blue"/>
</shape>
</item>
<item>
<shape>
<size android:width="20dp" android:height="20dp"/>
<corners android:radius="5dp"/>
<solid android:color="@color/white"/>
</shape>
</item>
</layer-list>
</item>
推荐答案
我已经看到了这个问题了很多,我发现的唯一的解决办法是:
I've seen this problem a lot, and the only solution I found is:
<item android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp">
<shape>
<solid android:color="@color/blue"/>
</shape>
</item>
如果你有一个更好的解决方案 - !回答
If you have a better solution - answer!
这篇关于层列表忽略&LT;尺寸和GT;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文