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
43
votes
7 answers

Android Typeface createFromAsset

I Have a Custom View which draws text onto the Canvas. I want to change the font to a font stored in the assets folder. I am using Android Studio so I created a folder src/main/assets and placed my ttf files in there. Paint txt = new…
Caleb Bramwell
  • 1,332
  • 2
  • 12
  • 24
41
votes
5 answers

How to change the FontSize in an Android WebView?

How can you manually change the font size of a webview? e.g. When the page loads up in the webview the font size is like 24pt. and way too large for my android's screen. I've looked into the "websettings" but it seems that the two are not…
Scott
  • 1,491
  • 2
  • 10
  • 9
38
votes
14 answers

Accessing a font under assets folder from XML file in Android

I am trying to do a application-wide font change and creating a style file to do so. In this file (below) I just want to change typeface value of TextAppearance style of Android.
erkangur
  • 2,048
  • 5
  • 21
  • 31
28
votes
3 answers

Android sp vs dp texts - what would adjust the 'scale' and what is the philosophy of support

So we know from many other posts that we should use sp rather than dp for text in Android, and we know the reason for this is to respect a 'user's preferences'. But precisely what are these preferences? How might a user change this setting? I cannot…
Sam
  • 3,453
  • 1
  • 33
  • 57
26
votes
15 answers

Android Runtime Exception font asset not found

Here is my code and screenshot I'm trying to set custom font typeface but Runtime exception occurs font asset not found while font file is in asset folder. Am I missing something ? Typeface font = Typeface.createFromAsset(getAssets(),…
Muzammil Husnain
  • 1,218
  • 1
  • 10
  • 24
24
votes
6 answers

How to change the Font Size in a whole Application programmatically, Android?

I have created Spinner with the list of Font Sizes from "8" to "46" . I could be able to click the font Size and in a spinner it has shown me . My need is, if i click the Font Size "26" inside a Spinner then it should be applied to my whole…
Achiever
  • 1,626
  • 10
  • 30
  • 54
23
votes
6 answers

Change Toast Font

Currently, I'm trying to develop an app. and I don't know how to change the Toast font. . final OnClickListener clickListener = new OnClickListener() { public void onClick(View v) { try { …
Ye Lin Aung
  • 11,234
  • 8
  • 45
  • 51
20
votes
6 answers

Use Roboto font for earlier devices

I would like to use the Roboto font in my Android application and make sure it works for earlier versions of Android that don't have the font installed. I know I can do this by using Typeface.createFromAsset() and then manually setting the font for…
Blather
  • 1,118
  • 5
  • 15
  • 25
19
votes
7 answers

Setting Button text font in android

I have a button created using android widgets. I want to set the font of the button text to Helv Neue 67 Med Cond. How to get this font and set it to the button text in android layout file?
Ajn
  • 573
  • 3
  • 8
  • 18
18
votes
4 answers

android - fontFamily not working on androidx

It's very strange that why fontFamily is not working on androidX . this is my code:
15
votes
2 answers

Is it possible to style the android fonts styles with leading and tracking?

Is it possible to have the followings in android font styling. Leading (the space vertically between lines of text - name comes from the physical piece of lead that used to be used in mechanical printing process to separate lines of text). Tracking…
Joshua
  • 442
  • 1
  • 5
  • 20
15
votes
4 answers

Reducing font size of AlertDialog.Builder's components

I created an AlertDialogue using the following code : int selectedModeId=0; public void sortTypeModeSelection(){ AlertDialog.Builder alertBuilder=new AlertDialog.Builder(WatchListDetailActivity.this); …
edwin
  • 7,985
  • 10
  • 51
  • 82
14
votes
6 answers

How do I set a custom font in an AlertDialog using Support Library 26

I am using revision 26.0.1 of the Android Support Library to set custom fonts in my app. In my app's theme, I added: @font/my_font It worked like a charm, converting the text in my whole app to my custom font.…
14
votes
3 answers

How to change ActionBar title font when using AppCompat

I would like to apply custom font to the title of my app which is displayed on the ActionBar. Previously I didn't use any support library and this solution: int titleId = getResources().getIdentifier("action_bar_title", "id", …
13
votes
1 answer

Crash on calligraphy library by chris Jenx for Android Q

I have a calligraphy library I am using for custom fonts which seems to work on all versions except for android Q , where it crashes my app right on launch.Any one else has had to deal with the same issue lately? Here's my crash report : Caused by:…
user11455292
1
2
3
24 25