And here is exactly how to customize your default font. In this tutorial, you will learn how to change the font style of Notification Content Title for Remote Views. For example, some devices, which are below 5.0 Android OS, don’t support Gujarati fonts, so you can apply Gujarati font in Notification by following below step. You can only show a TextView as Light, Regular and Condensed if the font that you're referencing allows those styles. For example, if you import a font into your project and it doesn't have Light or Condensed, I don't think it's (dare I say) possible to make the text appear with that style in your TextView.
A TextView displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing.
Following are the important attributes related to TextView control. You can check Android official documentation for complete list of attributes and related methods which you can use to change these attributes are run time.
This example will take you through simple steps to show how to create your own Android application using Linear Layout and TextView.
Following is the content of the modified main activity file src/com.example.demo/MainActivity.java. This file can include each of the fundamental lifecycle methods.
Following will be the content of res/layout/activity_main.xml file −
Following will be the content of res/values/strings.xml to define two new constants −
Following is the default content of AndroidManifest.xml −
Let's try to run your demo application. I assume you had created your AVD while doing environment setup. To run the app from Android studio, open one of your project's activity files and click Run icon from the toolbar. Android studio installs the app on your AVD and starts it and if everything is fine with your setup and application, it will display following Emulator window −
I will recommend to try above example with different attributes of TextView in Layout XML file as well at programming time to have different look and feel of the TextView. Try to make it editable, change to font color, font family, width, textSize etc and see the result. You can also try above example with multiple TextView controls in one activity.
A font resource defines a custom font that you can use in your app. Fonts can be individual font files or a collection of font files, known as a font family and defined in XML.
Also see how to define fonts in XML or instead use downloadable fonts.
You can bundle fonts as resources in an app. Fonts are compiled in