This is because the default (normal) font setting uses the sans value. Having no typeface set (the android:typeface attribute is not present) or having it set to normal or sans results in the same font style. The typeface property is stored in the XML layout file as the TextView's attribute android:typeface. Add several TextViews to the screen each set to a different typeface value to compare them. Increase the textSize to better see the changes you make to the properties.įor the TextView find the typeface property and try the various settings of normal, sans, serif, and monospace. With a TextView selected its properties can be changed in the Properties pane. With the Design mode open select the Hello World! TextView.
SRC FOR DROID FONT ANDROID
The new Android Studio project will have an activity_main.xml as the starting layout. Edit the Text Properties with the Android Studio's Graphical Layout All other settings are left at their default values. Here the project is called Fonts and uses an Empty Activity.
SRC FOR DROID FONT CODE
SRC FOR DROID FONT FOR ANDROID
Import the Font for Android TextViews and EditTexts a/android/app/src/main/java/com/fontdemo/MainApplication.java +++ b/android/app/src/main/java/com/fontdemo/MainApplication.java -7,6 +7,7 import ⚠️ If you are registering a different font, make sure you replace "Raleway" with the name found in the former step (find font family name). In android/app/src/main/java/com/fontdemo/MainApplication.java, bind the font family name with the asset we just created inside onCreate method. It is shipped with many Linux distributions. You will need otfinfo installed in your system to perform this step. We will assume those files are now stored in /tmp/raleway/. You need the whole Raleway font family, extracted in a temporary folder. Of course, this method will work with any TTF font. For this example, we are going to register the Raleway font family.