【发布时间】:2014-03-25 23:29:22
【问题描述】:
我正在开发一个使用扩展 @style/Theme.AppCompat.Light.DarkActionBar 的主题的应用程序。
在我的一项活动中,有一个操作栏图标显示三个带有单选按钮的选项(这里是菜单 XML 文件的摘录):
<item
android:icon="@drawable/ic_action_filter_white"
android:showAsAction="always"
android:title=""
preparatest:showAsAction="always">
<menu>
<group android:checkableBehavior="single" >
<item
android:id="@+id/menu_filter_all"
android:title="@string/history_list_filter_all"
android:checked="true"/>
<item
android:id="@+id/menu_filter_pending"
android:title="@string/history_list_filter_pending"/>
<item
android:id="@+id/menu_filter_finished"
android:title="@string/history_list_filter_finished"/>
</group>
</menu>
</item>
我想给这些单选按钮一个自定义样式,但我不知道在哪里做。在我的 styles.xml 文件中,我将自定义样式定义为
<style name="RadioButtonPTGreenTheme" parent="android:Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/ptgreentheme_btn_radio_holo_light</item>
</style>
并尝试使用所有这四个选项,但无济于事:
<item name="android:radioButtonStyle">@style/RadioButtonPTGreenTheme</item>
<item name="android:listChoiceIndicatorSingle">@style/RadioButtonPTGreenTheme</item>
<item name="android:radioButtonStyle">@drawable/ptgreentheme_btn_radio_holo_light</item>
<item name="android:listChoiceIndicatorSingle">@drawable/ptgreentheme_btn_radio_holo_light</item>
有人知道怎么做吗?谢谢!
【问题讨论】:
标签: android android-actionbar android-actionbar-compat