Align Icons in Tab Layout To The Left

后端 未结 6 1487
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 00:44

Hello I have created a tab layout in my activity. This is the main .xml file:




        
6条回答
  •  渐次进展
    2020-12-18 01:20

    You have to introduce ActionMenuView inside Toolbar.

    From Google Official docs "ActionMenuView is a presentation of a series of menu options as a View. It provides several top level options as action buttons while spilling remaining options over as items in an overflow menu. This allows applications to present packs of actions inline with specific or repeating content."

    Eg,

    
    
        
    
    

    And on your Activity,

    Toolbar t = (Toolbar) findViewById(R.id.tToolbar);
        amvMenu = (ActionMenuView) t.findViewById(R.id.amvMenu);
        amvMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem menuItem) {
            return onOptionsItemSelected(menuItem);
          }
        });
    

提交回复
热议问题