In material design 3, there are 15 types of typography tokens:
- textAppearanceDisplayLarge (57sp)
- textAppearanceDisplayMedium (45sp)
- textAppearanceDisplaySmall (36sp)
- textAppearanceHeadlineLarge (32sp)
- textAppearanceHeadlineMedium (28sp)
- textAppearanceHeadlineSmall (24sp)
- textAppearanceTitleLarge (22sp)
- textAppearanceTitleMedium (16sp)
- textAppearanceTitleSmall (14sp)
- textAppearanceBodyLarge (16sp)
- textAppearanceBodyMedium (14sp)
- textAppearanceBodySmall (12sp)
- textAppearanceLabelLarge (14sp)
- textAppearanceLabelMedium (12sp)
- textAppearanceLabelSmall (11sp)
Here is how I used the tokens:
values\dimens.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textSizeDisplay">36sp</dimen>
<dimen name="textSizeHeadline">24sp</dimen>
<dimen name="textSizeTitle">14sp</dimen>
<dimen name="textSizeBody">12sp</dimen>
<dimen name="textSizeLabel">11sp</dimen>
</resources>
values-large\dimens.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textSizeDisplay">45sp</dimen>
<dimen name="textSizeHeadline">28sp</dimen>
<dimen name="textSizeTitle">16sp</dimen>
<dimen name="textSizeBody">14sp</dimen>
<dimen name="textSizeLabel">12sp</dimen>
</resources>
values-xlarge\dimens.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textSizeDisplay">57sp</dimen>
<dimen name="textSizeHeadline">32sp</dimen>
<dimen name="textSizeTitle">22sp</dimen>
<dimen name="textSizeBody">16sp</dimen>
<dimen name="textSizeLabel">14sp</dimen>
</resources>
Depending on the text type, I use the tokens
<com.google.android.material.textview.MaterialTextView
...
android:textSize="@dimen/textSizeTitle" />
The question:
Did I use the tokens in the right way or there is another way to use the tokens?
Also, I know when I should use Display and Body, But when should I use Headline, Title, and Label because I think they are the same?
I read this and this but still don't know when should I use Headline, Title, and Label.
Thank you.
You should refer to this documentation to implement the material 3 type scale (link can be found on the material 3 website in this section of the typography documentation by the way).
As a short explanation of how to implement:
Material3theme, for example:Don't forget to specify your theme in your
AndroidManifest.xmlfile:then in your theme.xml:
As for
Headlinevs.Titlevs.Label, the documentation you linked seems clear to me:Headlinestyle for high emphasis text that is shortTitlestyle for medium emphasis text that may be longerSo for example if you have a card with a title, you may use the
Headlinestyle if it says "Ada Lovelace" butTitleif it says "Design is where science and art break even".