I am new to Android and I am creating Listview Popup Menu. But I am having it's width
and height
problem. The Popup Menu can take more height and width. There are many questions in SO, but none of these helped me.
To create Popup Menu I have tried the following method.
1 ] Using Popup menu with the code below:
private void showPopupMenu(View view){
Context wrapper = new ContextThemeWrapper(this, R.style.PopupMenu);
PopupMenu popupMenu = new PopupMenu(wrapper,view);
popupMenu.getMenuInflater().inflate(R.menu.popup_menu,popupMenu.getMenu());
popupMenu.show();
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
@Override
public boolean onMenuItemClick(MenuItem item){
switch (item.getItemId()){
case R.id.install:
Intent intent = new Intent(ViewAllRelationActivity.this,EditRelativeActivity.class);
startActivity(intent);
break;
case R.id.addtowishlist:
break;
}
return false;
}
});
}
It gives this output :
2 ] Using ContextMenu it displays the following output :
We can maintain width and height in ContextMenu But it always show in Centre not each row of our Listview Data
.
But I want below Image type Popup menu
. Width and height are small.
Please provide the solution for this.