Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase space between text and it's underline in TextView Android?

I want to increase space between text and it's underline. I can change line height but I don't change height between text and it's underline.How can I do this ?

private static final String FONTH_PATH = "fonts/Brandon_bld.otf";

...

selectTextView = (TextView) findViewById(R.id.selectTextView);
selectTextView.setTypeface(font);

SpannableString content = new SpannableString(getResources().getString(R.string.select_your_prove_type));
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
selectTextView.setText(content);

...

and xml file

<TextView
android:id="@+id/selectTextView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="536"
android:gravity="left"
android:lineSpacingMultiplier="0.8"
android:text="@string/select_your_prove_type"
android:textColor="@color/Blue"
android:textSize="@dimen/select_size" />
like image 505
buraktemzc Avatar asked Sep 23 '14 11:09

buraktemzc


People also ask

How do I increase line spacing in android?

You can use lineSpacingExtra and lineSpacingMultiplier in your XML file. In other words, each line height will be height * multiplier + extra .

How do you underline text in TextView?

You can also underline a portion of the text via code, it can be done by creating a SpannableString and then setting it as the TextView text property: SpannableString text = new SpannableString("Voglio sottolineare solo questa parola");text. setSpan(new UnderlineSpan(), 25, 6, 0);textView. setText(text);

How do I increase the space between text and underline in Word?

The "Add space for underlines" layout option is used when you want to increase the gap between the text and underline. Try to underline first the words, sentences or paragraphs that you want to underline then click the said option to add space in between them.

Which method is used to change the text size of the TextView?

To use preset sizes to set up the autosizing of TextView programmatically, call the setAutoSizeTextTypeUniformWithPresetSizes(int[] presetSizes, int unit) method. Provide an array of sizes and any TypedValue dimension unit for the size.


2 Answers

Just use the

paddingBottom

as follows

         <android.support.design.widget.TextInputLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/fragment_activity_edit_desc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingBottom="16dp"
                android:hint="Description"
                android:textSize="34sp"
                tools:text="Secret Death Ray Design"/>


        </android.support.design.widget.TextInputLayout>
like image 179
Uzair Avatar answered Sep 20 '22 13:09

Uzair


Add these line in EditText

<EditText
   ...
   android:includeFontPadding="true"
   android:paddingBottom="20dp" />
like image 28
Joseph mcclane Avatar answered Sep 19 '22 13:09

Joseph mcclane