如何以编程方式更改选项卡指示器颜色指示器、选项卡、颜色、方式

2023-09-12 23:40:03 作者:薄凉先森

我的的新到Android 的,然后开始编程之前找到我,现在是一个天许多应用程序都使用片段,尤其是的标签与Swipeable意见的

如何改变的的标签指示/高亮颜色的(我用Google搜索,改变动作条颜色为红色编程),但不知道如何更改选项卡指示器颜色为红色。 (优先级编程)

还是我的动作条看起来像这

我使用下面的行来改变的的动作条的背景颜色的,但我也需要改变标签指示灯的颜色编程。

 动作条= getActionBar();
actionBar.setBackgroundDrawable(新ColorDrawable(Color.RED));
 

解决方案

我用杰夫Gilfelt,S Android的动作栏样式生成器。您可以使用图形用户界面风格你的标签,并在最后你得到的源$ C ​​$ C,您可以使用,查看和修改相应。 :)

下面是一个链接。

http://jgilfelt.github.io/android-actionbarstylegenerator/#name=example&compat=holo&theme=light&actionbarstyle=solid&texture=0&hairline=0&neutral$p$pssed=1&backColor=E4E4E4%2C100&secondaryColor=D6D6D6%2C100&tabColor=33B5E5%2C100&tertiaryColor=F2F2F2%2C100&accentColor=33B5E5%2C100&cabBackColor=FFFFFF%2C100&cabHighlightColor=33B5E5%2C100

CAD更改背景颜色的操作方法

I am new to Android, and before starting programming i found that now a days many of the apps are using Fragments, especially Tab with Swipeable Views

How to change Tab Indicator/highlight color (I googled and changed ActionBar color to RED programmatically), but don't know how to change Tab Indicator color to RED. (priority programmatically)

still my ActionBar looks like this

I am using below lines to change background color of ActionBar, but i also need to change the color of Tab Indicator programmatically.

actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.RED));

解决方案

I use Jeff Gilfelt,s Android Action Bar Style Generator. You can use GUI to style your tabs and at the end you get the source code which you can use, review and modify accordingly. :)

Here's a link.

http://jgilfelt.github.io/android-actionbarstylegenerator/#name=example&compat=holo&theme=light&actionbarstyle=solid&texture=0&hairline=0&neutralPressed=1&backColor=E4E4E4%2C100&secondaryColor=D6D6D6%2C100&tabColor=33B5E5%2C100&tertiaryColor=F2F2F2%2C100&accentColor=33B5E5%2C100&cabBackColor=FFFFFF%2C100&cabHighlightColor=33B5E5%2C100