Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a separator between menu items in ActionBar?

Tags:

android

How to add a separator between menu items in ActionBar likewise it's made in Gmail app?

enter image description here

like image 864
Eugene Avatar asked Aug 25 '11 11:08

Eugene


Video Answer


1 Answers

Well when I was trying to make my own action bar I used a black FrameLayout in which all the items of the action bar will be displayed. I set the layout_margin attribute on each item at 1dp so it would appear like there was a black separator on either side - if you want it to be larger you can increase the margin.

<FrameLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="#000000">
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
        <ImageButton ....... />
        <ImageButton ...... android:layout_marginLeft="1dp"/> <!-- this will be shown as a separator-->
    </LinearLayout>
</FrameLayout>
like image 123
ColdFire Avatar answered Nov 15 '22 01:11

ColdFire