Android的动作条标签颜色 [英] Android ActionBar Tab Color

查看:174
本文介绍了Android的动作条标签颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了动作条的标签我的应用程序。默认颜色的下划线是浅蓝色。我要如何改变颜色或样式选择的标签?

I have added ActionBar tabs to my application. Default color for that underline is light blue. How do I change that color or style for selected tab ?

推荐答案

对于任何人想改变动作条的颜色/背景code,你可以做这样的事情

For anyone wants to change actionbar color/background in code, you can do something like this

final ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_bg));

要改变动作条下的标签栏的颜色:

To change the tab bar color under the actionbar:

actionBar.setStackedBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.color_brown_dark)));

要更改标签栏背景:

actionBar.setStackedBackgroundDrawable(getResources().getDrawable(
            R.drawable.coupon_header));

这篇关于Android的动作条标签颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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