Skip to content Skip to sidebar Skip to footer

Android Text Field: Distance Between Line And Text

Google Material Design recommends to align items so that text falls on a 4dp baseline (source). It also recommends specific paddings between elements. I am a designer and I think w

Solution 1:

Set android:paddingBottom="12dp" on your EditText.

Solution 2:

Here's my take on the issue: When you specify the dimensions of x dp units, you basically say the dimension should be x px on a 160 dpi screen. If the screen is 240 dp, the dimension will convert to x * 1.5 px. In a nutshell: px = dp * (dpi / 160).

Now, with the vast number of devices in the Android ecosystem, be assured that decimal px units will ALWAYS creep-in. Android has its own ways for resolving these, which is what is probably happening in the screen above. For a unit as small as 12dp, the system is bound 'eat' a few pixels in an attempt to translate the dimension for individual screens.

By the way, being both a developer and a designer, I can confidently say that your developer mentally stabbed you if you asked him to find ways to change the height between the bottom line and text.

Post a Comment for "Android Text Field: Distance Between Line And Text"