How to put a row to separate items from a menu?

Asked

Viewed 5,006 times

2

Hello, someone knows how to place a horizontal line to separate items from my menu without having to use the tag <group>? I have the following code:

<menu>

<item android:id="@+id/action_rate"
    android:title="@string/action_rate"
    android:orderInCategory="100"/>


<item android:id="@+id/action_comment"
    android:title="@string/action_comment"
    android:orderInCategory="100"/>

<item android:id="@+id/action_about"
    android:title="@string/action_about"
    android:orderInCategory="100"/>

</menu>

2 answers

3

Try this between the items:

<View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@color/dark_gray2"
        android:focusable="false" />
  • Didn’t work :\

  • color changed? maybe the color dark_gray is not in the theme you are using

  • Yes I have, it was the first thing I noticed.

  • 1

    Use attribute with embedded color android:background="@android:color/darker_gray" that will work smoothly.

3

alternatively you can also use Android Studio’s graphic prototyping tools, available in the design menu, or if you prefer, Important a framework as bootstrap and take the elements you want. there is a good library for this kind of things, available at: https://github.com/wasabeef/awesome-android-ui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.