I wanted to know how to add my own custom font to the app name that appears in the action bar in android studio.
Asked
Active
Viewed 321 times
0

Tim
- 41,901
- 18
- 127
- 145

Simeon Mark Fernandes
- 107
- 2
- 11
-
http://stackoverflow.com/questions/3651086/android-using-custom-font – Tim Sep 18 '15 at 10:43
-
http://stackoverflow.com/questions/3438276/change-title-bar-text-in-android?rq=1 – KishuDroid Sep 18 '15 at 10:54
-
1OP did you tried anything ? If `yes` then post the code pls ~thanks – Maveňツ Sep 18 '15 at 10:54
2 Answers
1
You can set CustomLayout in ActionBar
this.getActionBar().setDisplayShowCustomEnabled(true);
this.getActionBar().setDisplayShowTitleEnabled(false);
LayoutInflater inflator = LayoutInflater.from(this);
View v = inflator.inflate(R.layout.titleview, null);
//if you need to customize anything else about the text, do it here.
//I'm using a custom TextView with a custom font in my layout xml so all I need to do is set title
((TextView)v.findViewById(R.id.title)).setText(this.getTitle());
//assign the view to the actionbar
this.getActionBar().setCustomView(v);
You can assign the custom font to textview by using setTypeFace()

Vadim Kotov
- 8,084
- 8
- 48
- 62

Ashish Agrawal
- 1,977
- 2
- 18
- 32
0
I did this by just making an image of the app name with the custom font then displaying the image as the logo in the action bar. Much simpler.
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setLogo(R.drawable.app_logo);

kris larson
- 30,387
- 5
- 62
- 74
-
-
The image is scaled to fit the action bar quite nicely. Oh, and the letters were different colors -- white and back against.a blue action bar. Looked great. – kris larson Sep 19 '15 at 13:18