如何更改操作栏选项卡选择事件的特定选项卡颜色变化 我正在使用带有 View 寻呼机的操作栏选项卡 以编程方式创建的选项卡
最佳答案
在 styles.xml 中
<style name="AppTheme" parent="android:Theme.Holo">
<item name="android:actionBarTabStyle">@style/MyTabStyle</item>
</style>
<style name="MyTabStyle" parent="android:Widget.ActionBar.TabView">
<item name="android:background">@drawable/my_drawable</item>
</style>
或在代码中:
TextView v = new TextView(...);
v.setBackground(R.drawable.my_bg);
ActionBar bar = getActionBar();
ActionBar.Tab tab = bar.getTabAt(position);
tab.setCustomView(v);
关于android - 如何以编程方式或在操作栏选项卡中使用 xml 更改选定的选项卡背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21406505/