如何改变标签栏的颜色在Android中? [英] How to change Color of the tabStrip in Android?

查看:121
本文介绍了如何改变标签栏的颜色在Android中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的标签栏的颜色更改为白色,下面的code不工作?我究竟做错了什么?

  getTabHost()getTabWidget()setLeftStripDrawable(Color.WHITE)。
。getTabHost()getTabWidget()setRightStripDrawable(Color.WHITE)。
。getTabHost()getTabWidget()setStripEnabled(真)。
 

解决方案

使用任何可绘制的,而不是颜色

表示setLeftStripDrawable是需要绘制资源,但你给INT作为一个参数。

因此​​,无论在这里使用一个绘制的图像。或使用XML从绘制contaning的颜色。

I am trying to change the color of my tabStrip to white, the code below is not working? What am I doing wrong ?

getTabHost().getTabWidget().setLeftStripDrawable(Color.WHITE);
getTabHost().getTabWidget().setRightStripDrawable(Color.WHITE);
getTabHost().getTabWidget().setStripEnabled(true);

解决方案

Use any drawable instead of color

means setLeftStripDrawable is requiring a drawable resource but you are giving int as a argument.

So either use a drawable image here. Or use a xml from drawable contaning the color.

这篇关于如何改变标签栏的颜色在Android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆