NEW SOLUTION
After Google I/O '17 you can create multiple font family in res/font folder
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/roboto_light"
app:fontStyle="normal"
app:fontWeight="300" />
<font
app:font="@font/roboto_bold"
app:fontStyle="normal"
app:fontWeight="700" />
</font-family>
and you can use wherever want
<style name="AppTheme.DefaultTextView" parent="android:style/Widget.TextView">
<item name="android:textColor">@color/colorBlack</item>
<item name="android:fontFamily">@font/font_family_roboto</item>
</style>
OLD ANSWER
Thanks for Jakob Eriksson
original answer
android:fontFamily="sans-serif" // roboto regular
android:fontFamily="sans-serif-light" // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed
android:fontFamily="sans-serif-black" // roboto black
android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
android:fontFamily="sans-serif-medium" // roboto medium (android 5.0)
in style:
<style name="AppTheme.DefaultTextView" parent="android:style/Widget.TextView">
<item name="android:textSize">@dimen/text_view_text_size</item>
<item name="android:textColor">@color/black</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textStyle">normal</item>
</style>
in app theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/gray</item>
<item name="android:textViewStyle">@style/AppTheme.DefaultTextView</item>
</style>
TextView
or you've to use afonts
library. – Nitin Misra