Menu

Making dashboard cards survive font scale 1.3 and density 560 on Android
📰

Making dashboard cards survive font scale 1.3 and density 560 on Android

DEV Community: mobile·seo seo·about 1 month ago
#Ylq0yqAs
#devtomobile#devto#dev#card#cards
Long article (460 words) — no AI summary yet.
Reading 0:00
15s threshold

A dashboard screen is a stack of fixed-size cards: a big clock, a weather card, a countdown, a month calendar. It looks right on my test phone, and then someone sets the system font to Large or runs a denser display, and text spills out of the cards. This is what I changed in my Android flip-clock app (Kotlin and XML) to stop that.

The two settings I test with

Both can be changed from adb, so every layout change gets checked at the extremes:

adb shell wm density 560 adb shell settings put system font_scale 1.3

Enter fullscreen mode

Exit fullscreen mode

After testing I put the device back with wm density 420 and font_scale 1.0 . It is easy to forget, and then every screenshot afterwards is wrong.

Decision 1: card text in dp, not sp

On the dashboard the cards have a fixed size. If their text is in sp , a larger system font makes the text outgrow the card.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.