我有一个非常简单的形状,我想设置它的宽度:
<shape android:shape="rectangle">
<solid android:color="@color/orange"/>
<size android:width="2dp"/>
</shape>
但是,当我将它分配为EditText的背景时,它只显示一个橙色背景,而不是宽度为2dp的矩形。设置大小为什么不起作用?我想创建一个透明的Drawable,在左侧有一个橙色的矩形。我还在一个selector中包装了它:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="@color/orange"/>
<size android:width="2dp" android:height="6dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</selector>
我尝试添加高度,看看它是否会改变大小。但它没有改变。就像完全忽略了大小一样。什么鬼?