I cannot find sans-serif-medium in Android Studio font family
I am following the typography guide and this link
How to change fontFamily TextView in Android
It says sans-serif-medium is available on Android 4.1 / 4.2 / 5.0.
But when I try to find these types of fonts, I cannot find a suggestion. What for??
Do I need to download ttf files for this font?
My executable SDK is 24.
+3
source to share
1 answer
Make it so to use the Sans Serif font.
In your styles.xml files define the font style
<style name="roboto_regular_textview" parent="@android:style/Widget.TextView">
<item name="android:fontFamily">sans-serif</item>
</style>
<style name="roboto_medium_textview" parent="@android:style/Widget.TextView">
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
</style>
<style name="roboto_light_textview" parent="@android:style/Widget.TextView">
<item name="android:fontFamily">sans-serif-light</item>
</style>
And in the layout.xml file
<TextView
style="@style/roboto_regular_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/black_text_color"
android:textSize="30sp" />
+2
source to share