如何实现这个选项菜单?
How to implement this Option Menu?
我想制作一个选项菜单,点击三点选项,它会水平显示添加、分享、收藏按钮。
喜欢这张图片 -> enter image description here
但是我做了这个-> 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
您可以使用ListPopupWindow
来处理您的案件。看到这个
我想制作一个选项菜单,点击三点选项,它会水平显示添加、分享、收藏按钮。 喜欢这张图片 -> enter image description here 但是我做了这个-> 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
您可以使用ListPopupWindow
来处理您的案件。看到这个