How can we use different styles of Roboto(or any other) font (Roboto-Regular, Roboto-Thin, Roboto-Bold etc) in a single custom TextView
.
One of the methods to do this programmatically is described here. But how to achieve this if we want to change style using XML.
Can this be done using custom attributes like this?
<com.project.abc.customviews.XYZTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome"
app:type="thin" />
I don't want to make different java files for each type. Another method is described here but this has issues regarding memory. Looking for a good solution.