vortek
vortek

Reputation: 484

Android material design `textAppearance` not working

Very new to Android and trying to use material design. In a hello world project, I have this layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            android:textAppearance="?attr/textAppearanceHeadline3"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

The textAppearance attribute is ignored. I have added:

api "com.google.android.material:material:1.1.0-alpha05"

to my dependencies.

What am I missing?

Upvotes: 2

Views: 1246

Answers (1)

Jack
Jack

Reputation: 5614

I had a similar problem before, try using

@style/TextAppearance.MaterialComponents.Headline3

Instead of

?attr/textAppearanceHeadline3

for your textAppearance attribute.

Upvotes: 5

Related Questions