EditText lineSpacingExtra issue

I have editText with layout:

<EditText android:id="@+id/edittext" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="test" android:layout_margin="5dp" android:gravity="left|center_vertical" android:lineSpacingExtra="10dp" android:lineSpacingMultiplier="1" /> 

but the text is not centered vertically due to lineSpacingExtra . Here's what it looks like:

enter image description here

How can I keep the lineSpacingExtra tag, but have the text vertically?

+7
source share
5 answers

I found a way to simulate this, but not the actual solution. You can add the top, but this is not a safe solution.

 <EditText android:id="@+id/edittext" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:paddingTop="18dp" android:gravity="left|center_vertical" android:lineSpacingExtra="10dp" android:lineSpacingMultiplier="1" android:text="test" /> 
+2
source

For me, this seems like a familiar problem that I first encountered when designing forms on the Internet and using the wrong CSS attributes, trying to give text fields more space.

So why not forget about this lineSpacingExtra attribute and just use padding top and padding bottom?

 <EditText android:id="@+id/edittext" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:gravity="left|center_vertical" android:text="test" /> 
0
source

I just did this TextView, it works great.

  <TextView android:id="@+id/txtWelcome" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:text="@string/activation" android:lineSpacingMultiplier="1.5" android:textAppearance="@style/CleverFingerThemeLarge" android:textColor="@color/DFTextColor" /> 

If I put android: lineSpacingExtra = "20dp"

I get more space between the lines.

In my example, @ string / activation = is text with multiple lines.

0
source

If you installed the following:

 android:includeFontPadding="false" android:lineSpacingExtra="1" android:lineSpacingMultiplier="0dp" 

your add-on should disappear!

0
source
 android:lineSpacingExtra="Your Value" android:lineSpacingMultiplier="Your Value" 
-3
source

All Articles