How (if possible) could I set a custom font in a ActionBar title text(only - not the tab text) with a font in my assets folder? I don't want to use the android:logo option.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
If you want to set typeface to all the TextViews in the entire Activity you can use something like this:
And the TypefaceCache:
It's an ugly hack but you can do it like this (since action_bar_title is hidden) :
This code is for post-GINGERBREAD devices but this can be easily extended to work with actionbar Sherlock as well
P.S. Based on @pjv comment there's a better way to find action bar title id
use new toolbar in support library design your actionbar as your own or use below code
Inflating Textview is not an good option try Spannable String builder
copy below class
I just did the following inside the onCreate() function:
I am using the Support Libraries, if you are not using them I guess you should switch to getActionBar() instead of getSupportActionBar().
In Android Studio 3 you can add custom fonts following this instructions https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html and then use your newly added font in "font_to_be_used"