[ACCEPTED]-draw line under TextView on Android-line
Accepted answer
This is the simplest and most similar to 7 using the <hr>
tag in HTML:
Put this in your 6 XML layout where you want the line:
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#ffffff" />
This 5 will draw a white line, 1 dp thick, across 4 the screen. If you want it to be a fixed 3 width, just change the layout_width
to the dp size you 2 want. Change the background
to the HTML color code 1 of your choice.
just add this style:
style="?android:listSeparatorTextViewStyle"
to your TextView
0
If you want to add programmatically then 2 do this:
mTextView.setPaintFlags(mTextView.getPaintFlags()| Paint.UNDERLINE_TEXT_FLAG);
or you can add this to strings.xml:
<string name="your_string_here"><u>This is an underline</u>.</string>
or 1 :
SpannableString spannableStringObject= new SpannableString("Your text here");
spannableStringObject.setSpan(new UnderlineSpan(), 0,
spannableStringObject.length(), 0);
textView.setText(spannableStringObject);
You can build a ListView, it has a divider, and 1 you can add line dynamically。
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.