i have a textview with large text in it, but i want to give bulletpoints, line breaks , i tried placing xml entities like •
for bullet point in my string.xml
, but unable to get linebreak and few text comes in the middle, i like to use justify too
String nodata="hi how are you<br/>•welcome to stackoverflow"
TextView nodata= ((TextView) findViewById(R.id.nodata));
nodata.setText(Html.fromHtml(nodatafound));
it kind of works but I am unable to use justify , is there any way I can achieve this?
Add Line Breaks to a TextView Just add a \n to your text. This can be done directly in your layout file, or in a string resource and will cleanly break the text in your TextView to the next line.
To construct a BulletSpan with a gap width of 40px, green bullet point and bullet radius of 20px: SpannableString string = new SpannableString("Text with\nBullet point"); string. setSpan(new BulletSpan(40, color, 20), 10, 22, Spanned. SPAN_EXCLUSIVE_EXCLUSIVE);
If you want to show a strike-through text you can do it programming using PaintFlags. You can set paint flags Paint. STRIKE_THRU_TEXT_FLAG to a TextView and it will add a strike-through to the text. TextView textView = (TextView) findViewById(R.
The two Button s at the bottom have android:text="◄" and "►" .
Thank you all...i finally ended up doing this
String nodata="hi how are you<br/>•welcome to stackoverflow"
TextView nodata= ((TextView) findViewById(R.id.nodata));
nodata.setText(Html.fromHtml(nodatafound));
and for justify left i did change in my layout file android:layout_gravity=center|left
i hope there is a betterway doing this.
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