I just changed our code to use the new SupportActionBar provided in the v7-appcompat library, but when I run the code on a Jellybean phone (apparently the same problem exists for Honeycomb and Ice Cream Sandwich), the home button has never been. seems activated.
Call getSupportActionBar (). setHomeButtonEnabled (true); doesn't seem to do what he says, but works for Gingerbread phones.
If I replaced it with getActionBar (). setHomeButtonEnabled (true) works.
The theme I use for v11 + is as follows:
<style name="MyTheme" parent="@style/Theme.AppCompat"> <item name="android:windowActionBar">true</item> <item name="android:windowNoTitle">false</item> <item name="android:listViewStyle">@style/MyListView</item> <item name="android:actionBarStyle">@style/MyActionBarStyle</item> <item name="android:windowSoftInputMode">stateAlwaysHidden</item> <item name="android:buttonStyle">@style/MyButton</item> <item name="android:radioButtonStyle">@style/MyRadioButtonStyle</item> <item name="android:windowContentOverlay">@drawable/ab_solid_dove_grey</item> <item name="android:windowTitleSize">@dimen/action_bar_height</item> <item name="android:selectableItemBackground">@drawable/sel_standard_item</item> <item name="android:windowBackground">@drawable/default_bg</item> <item name="android:actionMenuTextAppearance">@style/MyActionBarText</item> <item name="android:actionMenuTextColor">@color/gallery</item> <item name="android:tabWidgetStyle">@style/MyTabWidget</item> </style>
The style of the v11 + action bar is defined:
<style name="MyActionBarStyle" parent="android:style/Widget.Holo.ActionBar"> <item name="android:displayOptions">useLogo|showHome|showCustom</item> <item name="displayOptions">useLogo|showHome|showCustom</item> <item name="android:actionBarSize">@dimen/action_bar_height</item> <item name="android:icon">@drawable/ic_launcher</item> <item name="android:background">@android:color/transparent</item> </style>
Does anyone know why the home button is not activated if the version of Android that supports the action bar is correct.
=== UPDATE === I just looked at the source code of the appcompat library, and I noticed the following in ActionBarImplBase, which looks wrong:
setHomeButtonEnabled(abp.enableHomeButtonByDefault() || homeAsUp);
Does this mean that the "Home" button will be enabled only if the Android version is less than ICS or if the power indicator is on? - which I do not want.
android android-actionbar appcompat
Barry irvine
source share