There is an ActionBar
on each Android 4.0 application, and it got a title. I need to make this size less. But I don't understand how I can do it, because ActionBar
doesn't provide public methods for it. Remark: I don't want to use custom views.
Typeface typeFace = Typeface. createFromAsset(getAssets(), "fonts/font_name. ttf"); Now, get the child item (toolbar title textview) from the existing toolbar, the default toolbar and pass the typeface object we created above.
This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
Actually, you can do what you want to customize the ActionBar. It must be done through the Theme. You can do something like this :
<style name="Theme.YourTheme" parent="android:style/Theme"> <item name="android:actionBarStyle">@style/Theme.YourTheme.Styled.ActionBar</item> </style> <style name="Theme.YourTheme.Styled.ActionBar"> <item name="android:titleTextStyle">@style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item> </style> <style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="@android:style/Widget.TextView"> <item name="android:textSize">12sp</item> </style>
You could always do something like this:
ActionBar actionBar = getActionBar(); actionBar.setTitle(Html.fromHtml("<small>YOUR TITLE</small>"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With