Reputation: 35
I've got a simple view with some text on it, and all I want to do is come up with a good way of adjusting the text size and padding for smaller devices, my issue though is that I don't want to consider density, just the screen size itself. The idea is to make the apps look the same between a small and large device (including padding etc.)
I've seen a lot of posts about creating value resource directories with qualifiers but this hasn't worked, as any small device with a high DP gets the padding and text size of a larger device.
For a simple example, I want the text size to be 17sp on a Pixel 3 XL and be 14sp on a Nexus 5, but there just doesn't seem like a way to do this because they have similar pixel densities even though they are vastly different in actual screen size. Am I missing something??
Upvotes: 0
Views: 149
Reputation: 870
only one way to set dynamical change text size without density use android default font size like this
style="@android:style/TextAppearance.DeviceDefault.Small"
style="@android:style/TextAppearance.DeviceDefault.Medium"
style="@android:style/TextAppearance.DeviceDefault.Large"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="@android:style/TextAppearance.DeviceDefault.SearchResult.Title"
android:text="Hello"/>
Upvotes: 1