The first line is normal ways to show text on textview.
How I can show like the second ways?
Any help would be much appreciated! Thanks!
The first line is normal ways to show text on textview.
How I can show like the second ways?
Any help would be much appreciated! Thanks!
If you're looking for text that expands the spaces in between to take up whatever area, that's called "justified text". As far as I know it's not currently supported natively in android. This link has quite a number of workarounds, though, from custom textviews to using webviews.
EDIT
The below method does not appear to work anymore, or at least it didn't when I plugged it in to try it out. I would suggest using a custom view in that case. Refer to the link for more information.
Probably the easiest way would be using a webview (poached from the link):
<!--create a webview in xml-->
<WebView
android:id="@+id/textContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
and then in your activity you do:
WebView view = (WebView) findViewById(R.id.textContent);
String text;
text = "<html><body><p align=\"justify\">";
text+= "123456789";
text+= "</p></body></html>";
view.loadData(text, "text/html", "utf-8");
String temp = "";
for(int i=0;i<10;i++){
temp=temp+i+" ";
}
textView1.setText(temp);