Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Created March 15, 2018 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfversluis/d7cf31fd15e0cbc36efbf4b7d2c2a386 to your computer and use it in GitHub Desktop.
Save jfversluis/d7cf31fd15e0cbc36efbf4b7d2c2a386 to your computer and use it in GitHub Desktop.
Custom font for tabs on Android
<!-- add this new style to your style.xml -->
<style name="TabBar.TitleText" parent="TextAppearance.Design.Tab">
<!--set your custom font properties-->
<item name="android:fontFamily">@font/comicsaaaans</item>
</style>
<!-- Tabbar.axml -->
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="@android:color/white"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabTextAppearance="@style/TabBar.TitleText"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment