Android 在菜单项之间划一条线
我没有使用导航抽屉。 我只使用menu.xml,我想在这些项目之间画一条线。 我确信这条线是画出来的,但我认为它的颜色是白色的,所以我看不见它,我怎样才能改变它的颜色? 多谢各位Android 在菜单项之间划一条线,android,menu,Android,Menu,我没有使用导航抽屉。 我只使用menu.xml,我想在这些项目之间画一条线。 我确信这条线是画出来的,但我认为它的颜色是白色的,所以我看不见它,我怎样才能改变它的颜色? 多谢各位 <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.orangelabs.crypto.blindstorage.android.poc.HomeActivity">
<group android:checkableBehavior="none"
android:id="@+id/group1">
<item android:id="@+id/action_disconnect"
android:title="@string/action_disconnect"
app:showAsAction="never"/>
<item android:id="@+id/action_upload"
android:title="@string/action_upload"
app:showAsAction="never">
<menu>
<item android:id="@+id/action_chiffre"
android:title="@string/action_chiffre"
app:showAsAction="never"/>
<item android:id="@+id/action_non_chiffre"
android:title="@string/action_non_chiffre"
app:showAsAction="never"/>
</menu>
</item>
<item android:id="@+id/action_create_folder"
android:title="@string/action_create_folder"
app:showAsAction="never"/>
</group>
<group android:checkableBehavior="none"
android:id="@+id/group2">
<item android:id="@+id/action_logs"
android:title="@string/a_propos"
app:showAsAction="never"/>
</group>
</menu>
在菜单项之间使用此代码。
<View
android:height="1dp"
android:width="match_parent"
android: background="@android:color/grey"
/>
这是导航抽屉,在项目之间使用此代码
有关菜单项,请选中此链接:
此菜单是操作栏或导航抽屉的一部分?此菜单是操作栏的一部分,通过使用
width=match\u parent
和height=1或2
创建视图来创建自定义分隔线。抱歉,我不确定这在菜单上是否有效,我现在没有测试它的资料,但可能是;)。我得到这个错误:错误:(30,24)字符串类型不允许(在'width'处,值为'match_parent')。编辑。小错误。另外,我认为灰色比黑色好看。谢谢你,但它不起作用。我在菜单中没有看到任何变化。我也尝试过使用另一个布局作为action_布局,但分隔符似乎没有出现。。。。
<View
android:height="1dp"
android:width="match_parent"
android: background="@android:color/grey"
/>