java - OnLong Click ListView Pop-UP -


i implement in listview longclick, there succeeded :) create sort of pop-up more possibilities, example, paste, delete, remove, etc ... make understand found picture on internet :) ve mail below. thank in advance

enter image description here

try use pop menu this..

public class mainactivity extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     button button = (button) findviewbyid(r.id.button2);     registerforcontextmenu(button); }  @override public void oncreatecontextmenu(contextmenu menu, view v,         contextmenuinfo menuinfo) {     super.oncreatecontextmenu(menu, v, menuinfo);     getmenuinflater().inflate(r.menu.main, menu); }  public void showpopup(view v) {     popupmenu popup = new popupmenu(this, v);     getmenuinflater().inflate(r.menu.main, popup.getmenu());     popup.show();     popup.setonmenuitemclicklistener(new onmenuitemclicklistener() {          @override         public boolean onmenuitemclick(menuitem arg0) {             toast.maketext(mainactivity.this, "" + arg0, toast.length_short)                     .show();             return false;         }     }); }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; } 

}

and xml this..

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


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -