Skip to content

Instantly share code, notes, and snippets.

implementation 'com.android.support:appcompat-v7:26.1.0'
repositories {
google()
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/textXML"
android:layout_width="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
<!-- Long generated key -->
</item>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Abril Fatface"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/abril_fatface</item>
</array>
</resources>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/textXML"
android:layout_width="match_parent"
<TextView
android:id="@+id/textXML"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/abril_fatface"
android:text="This font was set via XML"
android:textSize="30sp" />
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="fontFamily">@font/abril_fatface</item>
</style>