popupmenu - How to set background image for popup menu in android? -


well have listed outed items in listview in popup menu, right need customize popup view background layout of listview. possible tried through surfing in net can't find solution. advance thanks.

my code:

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" >      <item         android:id="@+id/item1"         android:showasaction="ifroom|withtext"         android:title="add"         android:visible="true"/>     <item         android:id="@+id/item2"         android:showasaction="ifroom|withtext"         android:title="delete"         android:visible="true"/>     <item         android:id="@+id/item3"         android:showasaction="ifroom|withtext"         android:title="edit"         android:visible="true"/>  </menu> 

whant want in code:

enter image description here

you can try yourbuttonviewobject button onwhich click show popupwindow

listpopupwindow listpopupwindow = new listpopupwindow(             listpopupwindowappactivity.this);  //here can set custom adapter aswell         listpopupwindow.setadapter(new arrayadapter(             listpopupwindowappactivity.this,             r.layout.list_item, passyourarrayhere));         listpopupwindow.setanchorview(yourbuttonviewobject);         listpopupwindow.setwidth(300);         listpopupwindow.setheight(400);  listpopupwindow.setmodal(true);         listpopupwindow.setonitemclicklistener(             listpopupwindowappactivity.this);  //when click on yourbuttonviewobject show listpopupwindow listpopupwindow.show();  //and in onitemclick overiden method similar in listview 

Comments