我希望能够指定一个菜单项。
I want to be able to specify a custom view for a MenuItem.
我要显示在购物车中的菜单项,在操作栏中显示的许多项目是如何在车目前的指标。
I want to display an indicator on a shopping cart menu item in the action bar displaying how many items are in the cart currently.
是我能做到这一点的唯一方法是通过添加自定义视图,而不是利用菜单项的生命周期等?
Is the only way that I can do this is through adding a custom view instead of utilising the MenuItem lifecycle etc.?
要在菜单项叫setActionView(View视图)。
您可以提供要么是已经膨胀的视图或布局资源ID。
You can supply either an already inflated view or a layout resource ID.