Android ActionBar MenuItem LowerCase

后端 未结 7 1323
孤独总比滥情好
孤独总比滥情好 2020-12-13 06:41

I want to make MenuItem title in the ActionBar to LowerCase.

my menu.xml

  

        
7条回答
  •  我在风中等你
    2020-12-13 07:09

    From source code in android.support.v7.internal.view.menu.ListMenuItemView

    //Set text appearance in constructor from style
    ...
    mTextAppearance = a.getResourceId(R.styleable.MenuView_android_itemTextAppearance, -1);
    ...
    
    //Apply text appearance to view item
    mTitleView = (TextView) findViewById(R.id.title);
    if (mTextAppearance != -1) {
        mTitleView.setTextAppearance(mTextAppearanceContext, mTextAppearance);
    }
    

    In project: Create popup theme and apply it on popup creation for some custom popup if it's planned to use this appearance across whole application then put it to main application theme.

    
    
    ...
    Context context = new ContextThemeWrapper(getActivity(), R.style.PopupTheme);
    MenuPopupHelper optionsMenu = new MenuPopupHelper(context, menuBuilder, anchorView);
    ...
    

提交回复
热议问题