try this plug this pop-up menu in your click event to view bootom as a button click event
step 1 create a view when loading your layout, for example
<View android:layout_gravity="center" android:id="@+id/myView" android:layout_width="match_parent" android:layout_height="wrap_content"/>
step 2 create a new_menu.xml file like this
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/temp" android:title="@string/str_menu_account_logout" android:icon="@drawable/next" app:showAsAction="ifRoom"></item> </menu>
now add this code to create a options menu in your java file
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.new_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.temp) { PopupMenu popupMenu = new PopupMenu(this, findViewById(R.id.myView),Gravity.CENTER); popupMenu.inflate(R.menu.home_menu); popupMenu.show(); return true; } return false; }
source share