Toolbar font styles on Text Display toolbar fonts and icons on white
<name= "theme">@style/themeoverlay.appcompat.dark.actionbar </Item>
Font size, color, etc. on toolbar
<Itemname= "Android:titletextappearance">@style/toolbarsubtitle</Item><!--ToolBar Font Configuration -<stylename= "Toolbartitleappearance"><Itemname= "Android:textsize">30sp</Item><!--<item name= "Android:textstyle" >normal</item> -<Itemname= "Android:textcolor">@color/gold</Item></style>
Toolbar title Word limitlimit by setting Maxems or maxlength to Titletextappearance
<!--ToolBar Font Configuration - <stylename= "Toolbartitleappearance"> <Itemname= "android:maxems">1</Item> Invalid <Itemname= "android:maxlength">1</Item> Invalid </style>
Observe that Titletextappearance does not have a style that can directly set the word limit
Use the code to get the TextView on toolbar and then set the Maxems
Mtoolbar.getviewtreeobserver (). Addongloballayoutlistener (NewViewtreeobserver.ongloballayoutlistener () {@Override Public voidOngloballayout () {View View= Mtoolbar.getchildat (0); if(View! =NULL&& ViewinstanceofTextView) {TextView title=(TextView) view; Title.setmaxems (1); Mtoolbar.getviewtreeobserver (). Removeongloballayoutlistener ( This); } } });
By customizing the Toolbar.xml to achieve
Http://stackoverflow.com/questions/28487312/how-to-change-the-toolbar-text-size-in-android
<Android.support.v7.widget.ToolbarAndroid:id= "@+id/toolbar"Android:layout_height= "Wrap_content"Android:layout_width= "Match_parent"> <TextViewAndroid:id= "@+id/toolbar_title"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "hahaha"android:textsize= "25SP"/></Android.support.v7.widget.Toolbar>
Empty the toolbar default title and limit the number of words
Mtoolbar.settitle ("");
Mtextview.setmaxems (1)
Actionbar on menu Explicit font style
Reference http://www.crifan.com/android_menu_text_size_too_small/
@Override Public Boolean = Menu.add (Menu.none, Menu.first, 100, "search"); Item.setshowasaction (menuitem.show_as_action_always); returnSuper. Oncreateoptionsmenu (menu);}
Change the style of the search word on menu by changing the actionmenutextappearance
<stylename= "Apptheme"Parent= "Theme.AppCompat.Light.NoActionBar"><Itemname= "Android:actionmenutextappearance">@style/menutextstyle</Item></style><stylename= "Menutextstyle"><Itemname= "Android:textcolor">@color/white</Item><Itemname= "Android:textsize">18sp</Item></style>
Settings for toolbar and menu font styles