3

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

Sarah Sami
  • 577
  • 1
  • 6
  • 20

2 Answers2

1

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) ...

Matej Špilár
  • 2,617
  • 3
  • 15
  • 28
0

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.

Community
  • 1
  • 1
Kai
  • 15,284
  • 6
  • 51
  • 82