actionbar中使用ActionProvider显示自定义子菜单

http://developer.android.com/guide/topics/ui/actionbar.html#ActionProvider
http://stackoverflow.com/questions/19439106/cant-display-sub-menu-for-custom-actionprovider

Unfortunately, onPrepareSubMenu() is only called when onCreateActionView() returns null. Your solution (attaching a PopupMenu to the ImageView) will work, but since your ImageView is displaying an icon, you might consider just setting the icon in the menu XML and getting rid of the ImageView:

@Override
public View onCreateActionView(){
    return null;
}

猜你喜欢

转载自dengyin2000.iteye.com/blog/2054610
今日推荐