Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
When I use the
android:textFontWeight
attribute on a
TextView
, it doesn't select the appropriate font from the font family. I tested it on
API 28
, because the attribute is only available on 28+
<TextView
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/myfont"
android:text="Hello World!" />
The myfont
font-family is defined like this:
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/myfont_regular" />
app:fontStyle="normal"
app:fontWeight="200"
app:font="@font/myfont_thin" />
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.