我的问题: 如何在Google Play中获得此类效果?
以下是图片:
红色圆圈表示我的意思。
答案 0 :(得分:1)
正如codeMagic评论的那样,正确的方法是使用PopupMenu
,如下所示:
ImageView mOptions = (ImageView) findViewById(R.id.image); //the image you want press and get the menu to pop up on
mOptions.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
PopupMenu menu = new PopupMenu(this, view);
MenuInflater inflate = menu.getMenuInflater();
inflate.inflate(R.menu.simple_menu, menu.getMenu()); //inflate simple_menu, a menu list you created in resources
menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//handle menu clicks in here
return false;
}
});
menu.show();
}
});