Question
Can I set property of Textview like justify?
I want to set TextView property like right align, left align, of justify
Question
I want to set TextView property like right align, left align, of justify
Solution
No, you can't set the property like gravity. But still you can set the justification to your text by taking webview instead of text view.
You may refer to this.
Solution
What I understand from your question is, you want to know, how to set the alignment of text inside a TextView. You can align text in TextView to left, right, or center.
To do it from your layout (XML) file, use the following attribute in your layout file;
android:gravity=alignment
where,
alignment can be
To do the same from code, use the following;
TextView textRegion = (TextView) findViewById(R.id.textRegion);
textRegion.setGravity(gravity);
where,
gravity =
Gravity.LEFT to align to left
Gravity.RIGHT to align to right
Gravity.CENTER to center the text
Note that, justify is not available yet for text alignment in TextView.
Update as of Android 8 (Oreo, API Level 26):
Justification is now possible but look quite jagged at right end.
See setJustificationMode