Hi I am learning how to create libraries for android application. I am starting with custom textview
and set custom font on it.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/lobster"/>
Here I want to take fontFamily
value in this format @font/font_name
. Developers need to create font folder in the res
folder and put the fonts there. What do I need to do for this.? Thanks in advance.
I have created custom attribute using below approach.
attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Typekitable">
<attr name="fontFamily" format="string" />
</declare-styleable>
</resources>