Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android split ActionBar not working

I'm new with android ... i want to have a simple activity with a bottom action Bar in all tutorials it's mentionned that there is a way with

android:uiOptions=”splitActionBarWhenNarrow”

but it does not work on tablet or smal device even when i added

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

this is my manifest.xml

 <application
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        >
        <activity
            android:name=".launchActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:uiOptions="splitActionBarWhenNarrow"
            android:name=".MainActivity"
           >
            <meta-data android:name="android.support.UI_OPTIONS"
                android:value="splitActionBarWhenNarrow" />
        </activity>
        <activity
            android:name=".DisplayMessageActivity"
            android:label="@string/title_activity_display_message" >
        </activity>


        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>

build file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "xxxxxxx"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
like image 933
elpazio Avatar asked Apr 16 '26 22:04

elpazio


1 Answers

Android 5.0's default theme (Theme.Material) does not support the split action bar. Neither does the appcompat-v7 action bar backport anymore, though it used to.

Your options are either to switch to theme based off of Theme.Holo, put your own bar at the bottom of the screen (e.g., a Toolbar), or simply redesign your UI to avoid the split action bar.

like image 151
CommonsWare Avatar answered Apr 18 '26 12:04

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!