android - Show divider line in between menu items of native menu -
i want edit horizontal line between menu titles , refer many solutions not of them able find solution.please me find solution this
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <group android:id="@+id/grp1" android:checkablebehavior="single" > <item android:id="@+id/contact" android:icon="@mipmap/contact" android:title="contact us" android:checked="true" app:showasaction="collapseactionview"/> </group> <group android:id="@+id/grp2" android:checkablebehavior="single" > <item android:id="@+id/latest" android:icon="@mipmap/latest" android:title="latest ***" android:checked="true" app:showasaction="collapseactionview"/> </group> <group android:id="@+id/grp3" android:checkablebehavior="single" > <item android:id="@+id/my_picture" android:icon="@mipmap/my_picture" android:checked="true" android:title="my *** pictures" app:showasaction="collapseactionview"/>
thank in advance :)
you should use action layout
<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=".landingactivity"> <item android:id="@+id/action_cart" android:title="cart" android:actionlayout="@layout/cart_update_count" android:icon="@drawable/shape_notification" app:showasaction="always"/> </menu>
and action layout can have textview divider.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical"> <view android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/divider"/> <textview android:id="@android:id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:attr/selectableitembackground" android:gravity="center_vertical" android:textappearance="?attr/textappearancelistitemsmall"/> </linearlayout>
then can add click listener in code
Comments
Post a Comment