drawable:rect_ff8383_c100.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100dp" />
<solid android:color="@color/color_FF8383" />
</shape>
textView在xml中有padding设置
textView.setBackgroundResource(R.drawable.rect_ff8383_c100),不会修改textView的padding
如果drawable:rect_ff8383_c100.xml中设置了padding,会影响textview的padding
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100dp" />
<solid android:color="@color/color_FF8383" />
<!— 这个padding,作用到textview上—>
<padding
android:bottom="2dp"
android:left="10dp"
android:right="10dp"
android:top="2dp"/>
</shape>
网友评论