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" />
You can use lineSpacingExtra and lineSpacingMultiplier in your XML file. In other words, each line height will be height * multiplier + extra .
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);
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.
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.
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>
Add these line in EditText
<EditText
...
android:includeFontPadding="true"
android:paddingBottom="20dp" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With