[英]How to change the selected tab color in swipe tabs?
当前,我的应用程序中选定的选项卡以蓝色突出显示,如下所示。
如何给它换一个颜色?
您可以执行以下操作:
TabHost host = (TabHost)view.findViewById(R.id.tab_host);
TabWidget widget = host.getTabWidget();
for(int i = 0; i < widget.getChildCount(); i++) {
View v = widget.getChildAt(i);
// Look for the title view to ensure this is an indicator and not a divider.
TextView tv = (TextView)v.findViewById(android.R.id.title);
if(tv == null) {
continue;
}
v.setBackgroundResource(R.drawable.your_tab_selector_drawable);
}
检查此答案https://stackoverflow.com/a/15750561/3651574 。 它将解决您的问题。 干杯!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.