The official example of a navigation explorer has a minimum level of API 14. If this minimum is set in the ICS version (for example, 11), this will force a close, as the setHomeButton method is available only through API-14.
getActionBar().setHomeButtonEnabled(true);
When commenting on the previous statement, this leads to the exclusion of bloat, which is the result of using adroid sizes, which are also added to API-14.
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:textAppearance="?android:attr/textAppearanceListItemSmall" android:background="?android:attr/activatedBackgroundIndicator" android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
For my application, in which I support API-11 +, I solved it as follows.
1) In drawer_list_item.xml refer to user attributes
<?xml version="1.0" encoding="UTF-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/myapp_activatedBackgroundIndicator" android:gravity="center_vertical" android:minHeight="?attr/myapp_listPreferredItemHeightSmall" android:paddingLeft="16dp" android:paddingRight="16dp" android:textAppearance="?attr/myapp_textAppearanceListItemSmall" />
2) In the /attrs.xml values, specify your custom attributes
<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="Theme"> <attr name="myapp_listPreferredItemHeightSmall" format="dimension" /> <attr name="myapp_activatedBackgroundIndicator" format="reference" /> <attr name="myapp_textAppearanceListItemSmall" format="reference" /> </declare-styleable> </resources>
3) In values-11 / styles.xml
<resources> <style name="AppBaseTheme" parent="android:Theme.Holo"> <item name="myapp_listPreferredItemHeightSmall">48dip</item> <item name="myapp_textAppearanceListItemSmall">@style/MyappDrawerMenu</item> <item name="myapp_activatedBackgroundIndicator">@drawable/ab_transparent_action_bar</item> </style> <style name="MyappDrawerMenu"> <item name="android:textSize">16sp</item> <item name="android:textStyle">bold</item> <item name="android:textColor">?android:attr/actionMenuTextColor</item> </style> </resources>
4) In values-v14 / styles.xml
<resources> <style name="AppBaseTheme" parent="android:Theme.Holo"> <item name="myapp_listPreferredItemHeightSmall">?android:attr/listPreferredItemHeightSmall</item> <item name="myapp_textAppearanceListItemSmall">?android:attr/textAppearanceListItemSmall</item> <item name="myapp_activatedBackgroundIndicator">?android:attr/activatedBackgroundIndicator</item> </style> </resources>
If you want to support older / different versions, you need to add style.xml for this particular version.