android - Actionbar fills transparent icon pixels with wrong background -
i using actionbar sherlock. have icon transparent pixels. when run app, seems "something" replacing these transparent pixels main background theme, not actionbar background.
it not matter if main background specified @color or @drawable (9 patch) in latter case (which want) there additional quirk in few pixels of main background 9 patch appear @ right(!) hand edge of actionbar. go figure.
i have no idea what's going on here. if remove background items main style, actionbar looks should (so seems problem).
has else seen such behaviour before? taking look!
i'll paste style.xml below:
<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="viewpagerindicator"> <attr name="vpisubtabpageindicatorstyle" format="reference"/> </declare-styleable> <style name="theme.standby" parent="theme.sherlock.light.darkactionbar"> <item name="vpitabpageindicatorstyle">@style/customtabpageindicator</item> <item name="vpisubtabpageindicatorstyle">@style/customsubtabpageindicator</item> <item name="android:actionbarstyle">@style/theme.standby.app.actionbar</item> <item name="actionbarstyle">@style/theme.standby.app.actionbar</item> <!-- ------------------------------------------ -> <!-- tried both of these, can't transparent pixels in icon work ---> <!-- when use 9 patch (frg_background) in stead of plain color, there --> <!-- artefacts in of 9 patch pixels end on righthand --> <!-- side of action bar --> <!--<item name="android:background">@drawable/frg_background</item> <item name="background">@drawable/frg_background</item>--> <item name="android:background">@color/cream</item> <item name="background">@color/cream</item> <!-- ------------------------------------------ -> </style> <style name="theme.standbysubtab" parent="theme.sherlock.light.darkactionbar"> <item name="vpitabpageindicatorstyle">@style/customsubtabpageindicator</item> </style> <style name="theme.standby.app.actionbar" parent="widget.sherlock.actionbar"> <!-- both `android:xyz` , `xyz` need set support 4.x , 2.x devices. --> <item name="android:displayoptions">showhome</item> <item name="displayoptions">showhome</item> <item name="android:background">@drawable/bar</item> <item name="background">@drawable/bar</item> </style> <!-- top tab style --> <style name="customtabpageindicator" parent="widget.tabpageindicator"> <item name="android:background">@drawable/tab_background</item> <item name="android:textappearance">@style/customtabpageindicator.text</item> <item name="android:divider">@drawable/tab_divider</item> <item name="android:showdividers">middle</item> <item name="android:paddingleft">4dp</item> <item name="android:paddingright">4dp</item> </style> <style name="customtabpageindicator.text"> <item name="android:textcolor">@color/tab_text</item> <item name="android:textsize">10sp</item> <item name="android:textstyle">bold</item> </style> <!-- sub tab style --> <style name="customsubtabpageindicator" parent="widget.tabpageindicator"> <item name="android:background">@drawable/sub_background</item> <item name="android:textappearance">@style/customsubtabpageindicator.text</item> <item name="android:paddingleft">4dp</item> <item name="android:paddingright">4dp</item> </style> <style name="customsubtabpageindicator.text"> <item name="android:textcolor">@color/sub_text</item> <item name="android:textsize">10sp</item> <item name="android:textstyle">bold</item> </style> </resources>
edit: since problem goes away if not specify background
, android:background
in main style (theme.standby) occurred me might asking wrong question. purpose in putting these items in specify default background of fragments (content of tabs). works, has unwanted side-effects mentioned above. should doing in way? suggestions!
properties set on theme inherited every view when view resolves styles. in case, every view doesn't have explicit background set somewhere else render @color/cream background. bound cause kinds of visual problems you're experiencing, creating massive amounts of unnecessary overdraw.
a better way apply common styling fragments create style
<style name="fragment"> <item name="android:background">@color/cream</item> </style>
and reference root view of each fragment, e.g.
<linearlayout style="@style/fragment"> ... </linearlayout>
this means bit of typing reference style needs go each fragment, there no way avoid -- conceptually view classes can have own default style set theme (e.g. can point textviewstyle
attribute @ style definition, , apply textviews). fragments (or activities matter) aren't views, mechanism doesn't apply.
Comments
Post a Comment