Home > Mobile >  How to implement this Option Menu?
How to implement this Option Menu?

Time:12-30

I want to make a option menu where I click the three dot option it will show add, share, favorite button is there in horizontally. Like this Picture -> enter image description here But I made this - > enter image description here

XML

<LinearLayout
    android:layout_width="400dp"
    android:layout_height="wrap_content"
    android:background="@drawable/custom_linear"
    android:orientation="horizontal">


    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:elevation="5dp"
        android:src="@mipmap/fav_ic_round"
        android:layout_margin="15dp"
        android:background="@drawable/circular_shape"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
        />

    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:elevation="5dp"
        android:src="@mipmap/check_ic_round"
        android:layout_margin="15dp"
        android:background="@drawable/circular_shape"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
        />

    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:elevation="5dp"

        android:src="@mipmap/add_ic_round"
        android:layout_margin="15dp"
        android:background="@drawable/circular_shape"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
        />

    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:elevation="5dp"
        android:src="@mipmap/edit_ic_round"
        android:layout_margin="15dp"
        android:background="@drawable/circular_shape"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
        />

    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:elevation="5dp"
        android:src="@mipmap/share_ic_round"
        android:background="@drawable/circular_shape"
        android:layout_margin="15dp"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
        />
</LinearLayout>

I did this in a horizontal linear layout but there is a missing three dot option menu where I click this layout will showing. How to do that anyone please help me? I am new in design

CodePudding user response:

You can use ListPopupWindow to handle your case. See this How to set custom layout to item of menu?

  • Related