I wanted to reskin the RadioButton so that they all looked Holo, even on versions using ActionBarSherlock. Naturally, I turned to my theme and set the radioButtonStyle. However, the code below did not work:
<style name="MyTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:radioButtonStyle">@style/MyRadioButtonStyle</item> </style> <style name="MyRadioButtonStyle" parent="@android:style/Widget.CompoundButton.RadioButton"> <item name="android:button">@drawable/my_radio_button</item> </style>
I was fairly lost for a few hours because radioButtonStyle was clearly working on everything except for the widget popup. I could insert RadioButtons into my Activity and they'd pick up the new style, but the old style would remain for the action bar. What was going on?
The culprit is android:actionBarWidgetTheme.
Introduced in API 14, what it does is let you style Views inflated by the action bar separately from the rest of your Application or Activity. This is a neat trick, but if you don't know it exists, you could easily get lost on why your styles aren't applying to action bar Views.
If android:actionBarWidgetTheme is undefined, it falls back to the current theme's values. For most Android themes, that means you're fine. But in the case of Theme.Holo.Light.DarkActionBar, it does set the actionBarWidgetTheme to "@android:style/Theme.Holo". As a result, it will not fallback to your theme's default value.
I solved the problem by setting my own actionBarWidgetTheme that is a sub-style of the original actionBarWidgetTheme:
<style name="MyTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:actionBarWidgetTheme">@style/MyActionBarWidgetTheme</item> </style> <style name="MyActionBarWidgetTheme" parent="@android:style/Theme.Holo"> <item name="android:radioButtonStyle">@style/MyRadioButtonStyle</item> </style>
It's important to properly parent the actionBarWidgetTheme with whatever the theme was previously setting as its parent; otherwise you may miss out on some styling elsewhere.
I must say thank you, this bug waste me a whole weekend.
ReplyDeleteI must say thank you, this bug waste me a whole weekend.
ReplyDeleteinstall 9apps
android 9apps
avg pc tuneup crack
ReplyDeleteedius pro crack
ccleaner full crack
bitdefender total security crack
spotify crack
smarty uninstaller crack
glasswire elite crack
light image resizer crack
pdf-xchange editor crack
blue-cloner crack
"What i do not understood is in truth how you are no longer actually much more smartly-appreciated than you may be right now.
ReplyDeleteYou're very intelligent. You realize therefore considerably on the subject of
this topic, produced me in my opinion imagine it from a lot of numerous angles.
Its like men and women aren't involved except it is
something to do with Woman gaga! Your personal stuffs nice.
At all times care for it up!"
야한동영상
립카페
외국인출장
마사지
바카라사이트
Excellent blog I visit this blog it's really awesome. The important thing is that in this blog content written clearly and understandable. The content of information is very informative.
ReplyDelete온라인카지노
카지노
스포츠토토탑