Hello i have to create a PopUp Menu and i know how to do that.
Here is my code to create default PopUp Menu ..
popup_menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/item"
android:showAsAction="ifRoom|withText"
android:title="item1"
android:visible="true"/>
<item
android:id="@+id/item2"
android:showAsAction="ifRoom|withText"
android:title="item2"
android:visible="true"/>
<item
android:id="@+id/item3"
android:showAsAction="ifRoom|withText"
android:title="item3"
android:visible="true"/>
PopUpMenu_Activity.java
findViewById(R.id.btn_click).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
PopupMenu popupMenu = new PopupMenu(PopMenuActivity.this, view);
popupMenu.setOnMenuItemClickListener(PopMenuActivity.this);
popupMenu.inflate(R.menu.popup_menu);
popupMenu.show();
}
});
and
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.item1:
Toast.makeText(this, "item1 clicked", Toast.LENGTH_SHORT).show();
return true;
case R.id.item2:
Toast.makeText(this, "item2 clicked", Toast.LENGTH_SHORT).show();
return true;
case R.id.item3:
Toast.makeText(this, "item3 clicked", Toast.LENGTH_SHORT).show();
return true;
default:
return false;
}
}
My Question is how can i customize it? I want to add custom fonts in PopUp menu with semi transparent background as shown in figure. Please help...!!!