Sarah Sami
Sarah Sami

Reputation: 577

customize action bar in android

I need to customize action bar to look like this photo

enter image description here when click on image of right it opens slide menu from right of screen , that works fine I tried that so far

getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar));
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

action_bar.xml

<?xml version="1.0" encoding="UTF-8"?>

<item>
    <shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/fb"
        android:shape="rectangle" >
        <solid android:color="#00C78C" />
    </shape>
</item>
<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/aslogo" />
</item>

and for search and setting icons i used this in main.xml

<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="never"

    android:title="@string/action_settings"/>

 <item
    android:id="@+id/action_help"
    android:icon="@drawable/assetting"
    android:showAsAction="always"/>

<item
    android:id="@+id/action_search"
    android:icon="@drawable/assearch"
    android:showAsAction="always"/>

here is what i have so far

enter image description here

any help please

Upvotes: 3

Views: 304

Answers (2)

Kai
Kai

Reputation: 15476

If you are using Android's native Actionbar, proper RtL is only supported post Android 4.2: change action bar direction to right-to-left

If you want to support older Android versions, you probably have to customize one of the open source actionbar libraries, and use SlidingMenu for sliding from right action.

Upvotes: 0

Matej Špil&#225;r
Matej Špil&#225;r

Reputation: 2687

ok first of all .. remove your title with

getActionBar().setDisplayShowTitleEnabled(false);

then you should use orderInCategory in your xml file and it will order from less number to greater (from left side of your action bar) ...

Upvotes: 1

Related Questions