请用您使用的代码更新您的问题。您是否在可绘制对象中使用 xml 来为选项卡设置动画?这是使用 xml 处理的示例选项卡操作。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/ic_tab_about_grey"
android:state_selected="false" />
<!-- When not selected, use white-->
<item android:drawable="@drawable/ic_tab_about_color" android:state_selected="true"/>
</selector>
使用此 xml 文件自定义选项卡行为和图标。
这是在选项卡中设置此动画/自定义选项的代码:
intent = new Intent().setClass(this, sms.class);
spec = tabHost.newTabSpec("sms").setIndicator("SMS",
res.getDrawable(R.drawable.ic_tab_sms))
.setContent(intent);
tabHost.addTab(spec);
现在布局中的 XML 来定义 tab-host 和 tab-widgets。
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</TabHost>
使用您自己的颜色、字体和结构自定义此 xml 布局。