0

I want to show the split action bar for pre honey comb devices as same as post honey comb devices. for that i have included the following code in my manifest as per android docs.

<manifest ...>
<activity uiOptions="splitActionBarWhenNarrow" ... >
    <meta-data android:name="android.support.UI_OPTIONS"
               android:value="splitActionBarWhenNarrow" />
</activity>

after adding this also i am unable to show the split action bar for lower versions

Hamad
  • 5,096
  • 13
  • 37
  • 65
AndroidDev
  • 1,191
  • 3
  • 16
  • 35

2 Answers2

1

Import AppCompat project. Make sure you have added this Action Bar Compact (ABC) theme like this:

enter image description here

You should extend your activity to ActionBarActivity.

Have look at this for migrating from ABS to ABC

Update: Try with removing this

uiOptions="splitActionBarWhenNarrow"

<activity
    android:name="com.example.test.ExampleActivity"
    android:label="@string/activity_location_found"
    android:parentActivityName="com.example.test.ExampleActivity2" >
    <!-- To support below API Level 14 -->
    <meta-data android:name="android.support.UI_OPTIONS"
           android:value="splitActionBarWhenNarrow" />
</activity>

or To create this split effect, disable the action bar icon and title with setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false).

Other than this have a look it this ActionBar is only splitted when the available width is less than 480dp try to to test the code in small devices!

Community
  • 1
  • 1
LOG_TAG
  • 19,894
  • 12
  • 72
  • 105
  • I have mentioned already.. my application tag in manifest is as follows.. \ – AndroidDev Dec 24 '13 at 07:49
  • @Sravani have you extended your activity to ActionBarActivity ?? check the update – LOG_TAG Dec 24 '13 at 08:38
  • Yes i have extended actionbaractivity. my class declaration is like this.. public class MessageActivity extends ActionBarActivity implements AppObserver,android.support.v7.app.ActionBar.OnNavigationListener { }.. if you have any example which is working fine in lower version devices please give me. @LOG_TAG – AndroidDev Dec 24 '13 at 08:50
  • @Sravani http://www.androidhive.info/2013/11/android-working-with-action-bar/ use this sample! – LOG_TAG Dec 24 '13 at 09:05
  • To create this effect, disable the action bar icon and title with setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false). – LOG_TAG Dec 24 '13 at 09:14
  • I got it finally only thing is we need to change in menu fine... Thank you – AndroidDev Dec 24 '13 at 09:15
0

For enable the Split action bar for lower versions we need to Add the theme and meta-data tag in our manifest . and also we need to change the menu file as follows..

<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
to
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >

and also showsAsAction tag should change from

android:showAsAction="always"
to
yourapp:showAsAction="always"
AndroidDev
  • 1,191
  • 3
  • 16
  • 35