Android: how to indicate markers, line break on text in text form

I have a text view with large text in it, but I want to give bulletpoints, line breaks, I tried to place xml objects like for the marker in my string.xml , but could not get linebreak, and a little text appeared in mid i like to use also excuse

 String nodata="hi how are you<br/>&#8226welcome to stackoverflow" TextView nodata= ((TextView) findViewById(R.id.nodata)); nodata.setText(Html.fromHtml(nodatafound)); 

it's some kind of work, but I can’t use the excuse, is there a way I can achieve this?

+8
java android android-textview
source share
6 answers

Thanks everyone ... I finally made it

 String nodata="hi how are you<br/>&#8226;welcome to stackoverflow" TextView nodata= ((TextView) findViewById(R.id.nodata)); nodata.setText(Html.fromHtml(nodatafound)); 

and to justify the left, I changed the android:layout_gravity=center|left layout file android:layout_gravity=center|left

Hope it will be better.

+6
source share

You forgot the colon after &#8226;

So change it to this:

 String nodata="hi how are you<br/>&#8226;welcome to stackoverflow" TextView nodata= ((TextView) findViewById(R.id.nodata)); nodata.setText(Html.fromHtml(nodatafound)); 
+4
source share

put this code in strings.xml

hello how are you \ n

β€’ Welcome to stackoverflow

set this text to text box

+4
source share

try this, hope this works for you:

 String s = "hello world" + System.getProperty ("line.separator") + "hello android" + System.getProperty ("line.separator"); 
0
source share

Add to the file string.xml <string name="str">&#8226;item 1\n &#8226;item 2 \n &#8226; item 3</string> <string name="str">&#8226;item 1\n &#8226;item 2 \n &#8226; item 3</string>

0
source share

If you want to do this in java (I mean dynamically), use \n to break the line and the Unicode character for bullet ie \u25CF .

This is how i use it

 textView.setText("Welcome Username\n\u25CF Some Instructions"); 

It looks like this: Welcome Username ● Some instructions

Your case should be something like

 textView.setText("hi how are you\n\u25CF welcome to stackoverflow"); 

Here is the code

β€’ = \ u2022
● = \ u25CF
β—‹ = \ u25CB
β–ͺ = \ u25AA
β–  = \ u25A0
β–‘ = \ u25A1
β–Ί = \ u25BA

0
source share

All Articles