如何像Gmail应用程序一样在ActionBar中添加菜单项之间的分隔符?
![enter image description here](https://istack.dev59.com/XvA59.webp)
为了制作自己的工具栏,我使用了一个黑色FrameLayout,在其中显示所有工具栏项目。我在每个项目上设置了layout_margin属性为1dp,这样它就会呈现出两侧有黑色分隔符的效果 - 如果您需要更大的间距,可以增加边距。
<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>