Unexpected namespace prefix "app" found for tag TextView when I try to set fontFamily attribute

Viewed 4000

I set app:fontFamily="@font/montserrat_bold" on TextView and i get error: Unexpected namespace prefix "app" found for tag TextView. I use Android Studio 3.0. Is there any solution?

4 Answers

Try changing TextView to android.support.v7.widget.AppCompatTextView.

Not required

app:fontFamily="@font/montserrat_bold" 

Change to ,

android:fontFamily="@font/montserrat_bold"

it will work for sure.

Changing TextView to android.support.v7.widget.AppCompatTextView works if I use "app" name space prefix. If I use "android" name space prefix it provides compatibility with API version 16 and higher, but I needed compatibility from API version 14 so "app" prefix solved my problem.

this is working for me

<TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fontFamily="cursive"
        android:textSize="50sp"
        android:text="hhellloSDFSDF"/>
Related