【发布时间】:2012-09-19 03:59:14
【问题描述】:
我在 xml 中定义了一个可绘制对象:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<padding
android:bottom="1dp"
android:left="0dp"
android:right="0dp"
android:top="5dp" />
<corners
android:bottomLeftRadius="0.1dp"
android:bottomRightRadius="0.1dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>
并在布局xml中使用:
<RelativeLayout
style="@style/TabHeader"
android:background="@drawable/_moremsg_tab_back" >
<TextView
android:id="@+id/text"
style="@style/TabText"
android:text="TODO" />
</RelativeLayout>
效果是(第一个标签):
当点击其他选项卡时,我通过代码将可绘制对象添加为背景:
v.setBackgroundDrawable(getResources().getDrawable(R.drawable._moremsg_tab_back));
但是显示的和第一个不一样:
如何解决?
【问题讨论】:
标签: android layout background styles