user5404864
user5404864

Reputation:

Set default font family for Android app

I'm new to Android studio and I am wondering where to set the default font family for Android app in Android studio after reading the accepted answer here.

I have tried to put the code in activity_main.xml and AndroidManifest.xml but it does not work.

Any help would be appreciated!

Upvotes: 0

Views: 6983

Answers (2)

childofthehorn
childofthehorn

Reputation: 697

/res/values*/themes.xml

Pick any parent theme to extend here

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:textViewStyle">@style/RobotoFont</item>
</style>
<style name="RobotoFont" parent="android:Widget.TextView">
    <item name="android:fontFamily">sans-serif</item>
</style>
</resources>

Then in your app manifest

android:theme="@style/AppTheme`"

Upvotes: 1

user5404864
user5404864

Reputation:

Thanks KDeogharkar!

Looks like I would have to add the code inside of styles.xml in values folder. It worked :)

Upvotes: 2

Related Questions