安卓的RatingBar变星的颜色 [英] Android RatingBar change star colors
问题描述
我怎样才能改变恒星的颜色和我怎样才能改变恒星的大小?
How can i change the star colors and how can i change the size of the stars ?
推荐答案
第1步:创建你自己的风格,通过克隆现有样式之一(从 $ ANDROID_HOME /平台/ $ SDK /数据/res/values/styles.xml
),将它放在自己的项目的 styles.xml
,并引用它,当你添加窗口小部件到布局。
Step #1: Create your own style, by cloning one of the existing styles (from $ANDROID_HOME/platforms/$SDK/data/res/values/styles.xml
), putting it in your own project's styles.xml
, and referencing it when you add the widget to a layout.
第二步:创建自己的 LayerDrawable
XML资源,为的RatingBar
,指向相应的图像用于酒吧。原来的风格将指向你现有的资源,你可以比拟。然后,调整你的风格来使用自己的 LayerDrawable
的资源,而不是内置的。
Step #2: Create your own LayerDrawable
XML resources for the RatingBar
, pointing to appropriate images to use for the bar. The original styles will point you to the existing resources that you can compare with. Then, adjust your style to use your own LayerDrawable
resources, rather than built-in ones.
这篇关于安卓的RatingBar变星的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!