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.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="NightRiderFont" parent="@android:style/TextAppearance">
<item name="android:typeface"> /***help need here***/ </item>
</style>
</resources>
However font is in "assets/fonts/". How can I access this font, so I can use that style as a theme to get rid of changing all TextViews by hand programatically.
As summary: How can I access 'a file from assets folder' in XML?
fount change is very basic functionality in android which is mostly needed to each and every application.so every one want to change only once in application that reduce our development time so i would suggest you to see this link FountChanger.class.
You can access your font file from assets folder to xml file.
android:fontFamily="fonts/roboto_regular.ttf"
fonts is the sub folder in assets folder.
Uses this function if you are using single font.
hope use full to you:-
You Have just make Public calls And attached Method like this
have you use any where method TextView set font-family.
made FontList calss after you have just call methods any where with pass two parameter.
1.Fisrt we can add assets folder> in that your font styles.ttfs in your app then
2.write access code for fonts in strings like :
3.Accessing some layout xml file textview code like this below:
4.Add dimensions for font size :
5.Add font color in colors :
6.Then apply changes it is easy process to change hole app. Happy coding keep smile..