ActionBar with custom layout with custom menu item

后端 未结 1 950
北荒
北荒 2021-01-06 05:25

I want to make custom action bar by put ImageView in the middle and have another icon with some info on the right side of actionbar like this:

相关标签:
1条回答
  • 2021-01-06 05:39

    ActionBar has customView support. Do not use onCreateOptionsMenu() and R.menu.actionbar_right_icon. Instead create a layout that takes all of the views you have draw.

    You can do it like below

    LayoutParams layout_params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    getSupportActionBar().setCustomView(custom_view, layout_params); 
    
    0 讨论(0)
提交回复
热议问题