2016-07-14 71 views
-4

我在屏幕上有一個下拉圖標。如果我點擊下拉圖標,我想在圖標底部顯示對話框或彈出式菜單。成功地,我在菜單上單擊打開對話框,但該箭頭不適合該圖標。打開對話框的下拉圖標

enter image description here

+0

將代碼請! – Cgx

回答

0

調用此方法可在圖標中的單擊事件:

public void showPopupMenu(View v) { 
     PopupMenu popup = new PopupMenu(this, v); 
     MenuInflater inflater = popup.getMenuInflater(); 
     inflater.inflate(R.menu.my_menu, popup.getMenu()); 
     popup.show(); 
    }