0

I only want a TextView to be "12sp" if the screen has a pixel density of hdpi or less. Otherwise, I want the TextSize to be defined by Android Studio, as it usually happens when the attribute textSize is not defined specifically. How do I do that?

Currently, I have a dimens.xml file in values-hdpi with the code:

<?xml version="1.0" encoding="utf-8"?>
    <dimen name="text_size">12sp</dimen>
<resources>

this is in the relevant TextView in my XML file:

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/version_text"
    android:textSize="@dimen/text_size">

Currently, the TextView in all screen dimensions has the size 12sp

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Nicolae Stroncea
  • 587
  • 2
  • 6
  • 17

0 Answers0