0

i have a recycle view and on it item click i want to popup menu but it have too much width and going out side of the recycle view item width how to set it any body help me out of this problem thanks in advance.

here is image of problem

My menu Code

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<item android:id="@+id/edit"
    android:title="Edit"/>

<item android:id="@+id/delete"
    android:title="Delete"/>

code of recycler view itemclick

holder.img_menu.setOnClickListener(new View.OnClickListener() {
        @SuppressLint("ResourceType")
        @Override
        public void onClick(final View v) {
            PopupMenu popupMenu = new PopupMenu(v.getContext(), holder.img_menu);
            popupMenu.inflate(R.menu.feedoptions);
            popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    switch (item.getItemId()){
                        case R.id.edit:
                            Toast.makeText(v.getContext(), "Edit will Available Soon", Toast.LENGTH_SHORT).show();
                            break;
                        case R.id.delete:
                            Toast.makeText(v.getContext(), "Delete Option Will Available Soon", Toast.LENGTH_SHORT).show();
                            break;
                        default:
                            break;
                    }
                    return true;
                }
            });
            popupMenu.show();

        }
    });

0 Answers0