gridview - Android: Position of PopupMenu -
this question has answer here:
i'm using gridview , popupmenu every item of gridview. unfortunately popup appears below or on item clicked. appear on center of screen horizontally , vertically.
popupmenu popupmenu = new popupmenu(wrapper, v); popupmenu.getmenuinflater().inflate(r.menu.item_gridview_menu, popupmenu.getmenu());
i have tried setting gravity center this
popupmenu popup = new popupmenu(this, v,gravity.center);
but centers popup on item clicked. have styled popup with:
<style name="popupmenu" parent="@android:style/widget.popupmenu"> <item name="android:popupbackground">@android:color/white</item> <item name="android:gravity">center_horizontal</item> <item name="android:textcolor">@color/white</item> <item name="android:background">@color/colorprimary</item> </style>
but didn't either. ideas?
had task 1 , made custom alertdialog this.
final dialog dialog = new dialog(context); dialog.setcontentview(r.layout.custom); // custom xml dialog.settitle("title..."); // set custom dialog components - text, image , button textview text = (textview) dialog.findviewbyid(r.id.text); text.settext(); imageview image = (imageview) dialog.findviewbyid(r.id.image); image.setimageresource(); button dialogbutton = (button) dialog.findviewbyid(r.id.dialogbuttonok); dialogbutton.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { dialog.dismiss(); } }); dialog.show();
Comments
Post a Comment