Hope you are doing well
I want to Justify my Text in TextView
,
Is there any way to do that?
Thanks in Advance
Hope you are doing well
I want to Justify my Text in TextView
,
Is there any way to do that?
Thanks in Advance
XML Layout: declare WebView instead of TextView
<WebView
android:id="@+id/textContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
Java code: set text data to WebView
WebView view = (WebView) findViewById(R.id.textContent);
String text;
text = "<html><body><p align=\"justify\">";
text+= "This is the text will be justified when displayed!!!";
text+= "</p></body></html>";
view.loadData(text, "text/html", "utf-8");
This may Solve your problem.
I use this project to justify text. It works fine with my projects. JustifiedTextView
XML code
<com.codesgood.views.JustifiedTextView
android:padding="3dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/card_use_hint"/>
Result