Android 使用StateListDrawable的两个以上状态

Android 使用StateListDrawable的两个以上状态,android,android-layout,imageview,Android,Android Layout,Imageview,我有一个要求,我必须指定一个0星到5星的审查评级。该评级显示为ImageView。我理解,当按钮/视图存在两种状态时,可以使用StateListDrawable,例如选定状态和空闲状态 我的问题是,在这种情况下,是否有办法将更多的州包括在6个州中,并相应地显示可支取金额 目前我只能这样做- <selector> <item android:drawable="@drawable/zerostars" android:state_selected="t

我有一个要求,我必须指定一个0星到5星的审查评级。该评级显示为ImageView。我理解,当按钮/视图存在两种状态时,可以使用StateListDrawable,例如选定状态和空闲状态

我的问题是,在这种情况下,是否有办法将更多的州包括在6个州中,并相应地显示可支取金额

目前我只能这样做-

<selector>
    <item android:drawable="@drawable/zerostars"
          android:state_selected="true" 
          android:background="@color/tab_background_1" />
    <item android:drawable="@drawable/fivestars" />
</selector>

任何建议都会非常有用。

A似乎非常适合。

谢谢,这符合我当前的要求,也只是为了提供信息,我还找到了一个解决方案,在该解决方案中,我创建了一个自定义适配器,扩展了SimpleCorsOrAdapter,并根据返回的每个字符串设置可绘制值。