Questions tagged [android-fonts]

There are different fonts available to use programmatically and also using the device setting, Generally programmers do use fonts in a way that keeping the font file in assets folder and then passing the font as resource to textviews.

362 questions
345
votes
16 answers

How to set default font family for entire Android app

I'm using the Roboto light font in my app. To set the font I've to add the android:fontFamily="sans-serif-light" to every view. Is there any way to declare the Roboto font as default font family to entire app? I've tried like this but it didn't seem…
tomrozb
  • 25,773
  • 31
  • 101
  • 122
275
votes
25 answers

Is it possible to set a custom font for entire of application?

I need to use certain font for my entire application. I have .ttf file for the same. Is it possible to set this as default font, at application start up and then use it elsewhere in the application? When set, how do I use it in my layout XMLs?
Samuh
  • 36,316
  • 26
  • 109
  • 116
269
votes
21 answers

Android - Using Custom Font

I applied a custom font to a TextView, but it doesn't seems to change the typeface. Here is my code: Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/myFont.ttf"); TextView myTextView =…
RATTLESNAKE
  • 3,218
  • 2
  • 21
  • 24
211
votes
15 answers

Font size of TextView in Android application changes on changing font size from native settings

I want to specify my own text size in my application, but I am having a problem doing this. When I change the font size in the device settings, the font size of my application TextView also changes.
Vikasdeep Singh
  • 20,983
  • 15
  • 78
  • 104
138
votes
21 answers

Change the font of tab text in android design support TabLayout

I'm trying to work on the new TabLayout from the android design library. I want to change tab text to custom font. And,I tried to search some styling related to TabLayout,but ended up to this. Please guide how can I change the tab text fonts.
Dory
  • 7,462
  • 7
  • 33
  • 55
103
votes
12 answers

Set Indian Rupee symbol on text view

I am developing an application. And i need to set the symbol of Indian rupee on text view which is set with the text as amount. Symbol: I am having the font or .TTF file of this in Assets/fonts folder. And i tried to use it as : Typeface…
Manoj Fegde
  • 4,786
  • 15
  • 50
  • 95
101
votes
12 answers

Android: Want to set custom fonts for whole application not runtime

Is it possible to set any custom font in every control of the application? And not necessarily runtime ? (i.e. from xml if possible or only once for whole application in JAVA file) I can set the font for one control from this code. public static…
Prasham
  • 6,646
  • 8
  • 38
  • 55
96
votes
7 answers

How to set font custom font to Spinner text programmatically?

I have a ttf font file in my assets folder. I know how to use it for textviews with: Typeface externalFont=Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeueLTCom-Lt.ttf"); textview1.setTypeface(externalFont); I have defined look for my…
DixieFlatline
  • 7,895
  • 24
  • 95
  • 147
95
votes
10 answers

How set Spannable object font with custom font

I have Spannable object which I want to set its font by a custom font I have loaded before. Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/font_Name.ttf"); Spannable span1 = /*Spannable Item*/; /// I want to set span1 to have tf font…
Mohamed Ghonemi
  • 1,072
  • 1
  • 10
  • 12
93
votes
15 answers

How to set custom font for a whole application in Android?

Is it possible to set a custom font in an Android application? I tried what is posted here, but I don't know where my extends Application class is... Any help? EDIT: I tried the following: Add an assets folder and insert the font inside as seen…
Sonhja
  • 8,230
  • 20
  • 73
  • 131
84
votes
11 answers

How to use specified weights for fonts in XML

Using the Fonts in XML feature you can specify various font weights for a font family. For example:
Bryan
  • 14,756
  • 10
  • 70
  • 125
83
votes
13 answers

how to prevent system font-size changing effects to android application?

I recently finished developing my android application. I used sp (Scaled pixels) for all textSize. The problem is when i adjusted the system font-size, my application's font-sizes are changing. I can use dp (Device independent pixels) but it will…
james
  • 1,967
  • 3
  • 21
  • 27
71
votes
7 answers

How to add external fonts to android application

I was looking for some stylish fonts for my android application. but the problem is how can i make my android application supportable for external fonts. Thank you.
bHaRaTh
  • 3,464
  • 4
  • 34
  • 32
71
votes
4 answers

How do I specify eg. Roboto-Medium or Roboto-Black in styles.xml

Posts like this How to change fontFamily of TextView in Android suggests, that the variants of Roboto fonts you can specify in styles.xml in Android 4.2 boils down to the…
ckibsen
  • 943
  • 1
  • 7
  • 9
64
votes
9 answers

"RuntimeException: native typeface cannot be made" when loading font

I am attempting to use a custom font for a TextView on Android, following the guide here. Using the same font, same code, same everything, I get this in adb logcat: W/dalvikvm( 317): threadid=1: thread exiting with uncaught exception…
TheLQ
  • 14,830
  • 14
  • 69
  • 107
1
2 3
24 25