ActionBarSherlock: changing homeAsUpIndicator doesn't work
2015-02-21 21:15
453 查看
文章摘自stackoverflow上的一个帖子,解决了actionBar上换home图标左侧的“<”不起作用的问题。
原文如下:
Ask:
I'm want to change the up icon with applying the following style to my activity, but it doesn't work and but I still get the default black '<' icon.
Can anyone find out what is missing here?
Answer:
If I remember correctly, I
worked around this issue by moving you should move the
into the main theme declaration. In other words, try:
Not sure whether I also had to move up the
but you may want to give that a go too in case above doesn't work right away.
By the way, I find naming a style
then inheriting from
confusing. If it were an ActionBar specific style, I would've expected something like
any of the other widget styles) as the parent. If it's your main theme, I'd name it accordingly. Up to you of course.
原文如下:
Ask:
I'm want to change the up icon with applying the following style to my activity, but it doesn't work and but I still get the default black '<' icon.
Can anyone find out what is missing here?
<style name="AppTheme.ActionBar" parent="@style/Theme.Sherlock.Light"> <item name="actionBarStyle">@style/actionBarStyle</item> <item name="android:actionBarStyle">@style/actionBarStyle</item> </style> <style name="actionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar.Solid"> <item name="android:background">@drawable/header_bar</item> <item name="background">@drawable/header_bar</item> <item name="android:homeAsUpIndicator">@drawable/up_indicator</item> <item name="homeAsUpIndicator">@drawable/up_indicator</item> <item name="android:displayOptions">homeAsUp|showHome</item> <item name="displayOptions">homeAsUp|showHome</item> </style>
Answer:
If I remember correctly, I
worked around this issue by moving you should move the
android:homeAsUpIndicatorand
homeAsUpIndicatorelements
into the main theme declaration. In other words, try:
<style name="AppTheme.ActionBar" parent="@style/Theme.Sherlock.Light"> <item name="actionBarStyle">@style/actionBarStyle</item> <item name="android:actionBarStyle">@style/actionBarStyle</item> <item name="android:homeAsUpIndicator">@drawable/up_indicator</item> <item name="homeAsUpIndicator">@drawable/up_indicator</item> </style> <style name="actionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar.Solid"> <item name="android:background">@drawable/header_bar</item> <item name="background">@drawable/header_bar</item> <item name="android:displayOptions">homeAsUp|showHome</item> <item name="displayOptions">homeAsUp|showHome</item> </style>
Not sure whether I also had to move up the
displayOptions,
but you may want to give that a go too in case above doesn't work right away.
By the way, I find naming a style
AppTheme.ActionBarand
then inheriting from
Theme.Sherlock.Lightrather
confusing. If it were an ActionBar specific style, I would've expected something like
Widget.Holo.Light.ActionBar(or
any of the other widget styles) as the parent. If it's your main theme, I'd name it accordingly. Up to you of course.
相关文章推荐
- Xcode code sense and cmd+click to symbol doesn't work for 1 of my projects
- setComponentEnabledSetting doesn't work on widget 以及副作用
- eclipse插件Maven添加依赖查询无结果的解决方法(Select Dependency doesn't work)
- ROOT: Why TStyle::SetStatFontSize() doesn't work?
- Liferay color-scheme doesn't work
- set_terminate doesn't work
- Why dynamic_cast doesn't work ?
- File@CompanionFile doesn't work
- mysql check constraint doesn't work
- ViewPager.setOffscreenPageLimit(0) doesn't work as expected
- window.close() doesn't work - Scripts may not close windows that were not opened by script.
- BitmapImage.UriSource binding doesn't work ...
- My Backspace Key doesn't work!
- Attempting to start Apache service...but apache doesn't work
- TLS doesn't work on PPPoE in Chelan: MTU issue
- My Backspace Key doesn't work!
- 安装rhel5.4遇到的IO-APIC+timer doesn't work .
- adb logcat filter doesn't work
- eclipse插件Maven添加依赖查询无结果的解决方法(Select Dependency doesn't work)
- topmargin=\"0\" doesn\'t work in Firefox?