I want to show a custom layout in Popmenu. But I get this error
Java.Lang.RuntimeException: 'Expecting menu, got LinearLayout'
Is there a way to inflate this layout to PopupMenu
? This is my code and xml
private void ShowMenu(ImageButton anchor, Dictionary<string, object> data)
{
Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(_context, anchor);
menu.Inflate(Resource.Layout.menu_outlet_buttons);
menu.Show();
}
menu_outlets_buttons.xml
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="left"
android:background="@drawable/bg_round_corner_full">
<ImageButton
android:id="@+id/view_outlet_more_button"
android:layout_width="45dp"
android:layout_height="45dp"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:background="@color/transparent"
android:tint="@color/primaryColor"
android:scaleType="fitCenter"
android:src="@drawable/outline_more_vert_24"
android:padding="10dp"/>
<ImageButton
android:id="@+id/view_outlet_edit_button"
android:layout_width="45dp"
android:layout_height="45dp"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:background="@color/transparent"
android:tint="@color/primaryColor"
android:scaleType="fitCenter"
android:src="@drawable/outline_edit_24"
android:padding="10dp"/>
<Button
android:id="@+id/view_outlet_call_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Make a call"
android:background="?android:attr/selectableItemBackground"
android:backgroundTint="@color/whiteFull"
android:textColor="@color/secondaryColor"
android:textSize="15dp"
android:layout_marginRight="10dp"
android:drawableLeft="@drawable/shopping_cart_24px"
android:drawableTint="@color/secondaryColor"/>
</LinearLayout>
</LinearLayout>
This is what it look likes:
I want to do the reaction in FB messenger
I already search in internet but most of the post is not Xamarin.Android. Thanks in advance