开发者

How to add a separator between menu items in ActionBar?

How to add a separator between menu items in ActionBar likewis开发者_Go百科e it's made in Gmail app?

How to add a separator between menu items in ActionBar?


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜