[英]Changing tabHost & Rank selection color
I want to change the Blue color of the selection in the tabHost and in the Rank star...anyone know how do I can do that ? 我想在tabHost和Rank star中更改选择的蓝色...任何人都知道我该怎么做?
Thanks 谢谢
The Following image... 下图...
You need to add selector code in drawable folder file_name " selector.xml " 您需要在可绘制的文件夹file_name“ selector.xml ”中添加选择器代码。
<xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, color is white -->
<item android:color="@android:color/white"
android:state_selected="true" />
<!-- When not selected, color is green -->
<item android:color="@android:color/green" />
</selector>
Set this selector in your main file like this 像这样在您的主文件中设置此选择器
TabSpec tabSpecWindow = tabHost.setIndicator("", ressources.getDrawable(R.drawable.selector))
.setContent(new Intent( , ));
Changing the color of rating bar has similar process to selection color change Tabhost Get the star images of color which you want. 更改等级栏的颜色与选择颜色更改的过程相似。Tabhost获取所需颜色的星形图像。 create color.xml in drawable folder
在可绘制文件夹中创建color.xml
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background" android:drawable="@drawable/color_empty" />
<item android:id="@android:id/secondaryProgress" android:drawable="@drawable/color_half" />
<item android:id="@android:id/progress" android:drawable="@drawable/color_full" />
</layer-list>
Now in your rating bar add below code 现在在您的评分栏中添加以下代码
<RatingBar android:progressDrawable="@drawable/color"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.