I want to set TextView property like right align, left align, of justify
Properties of TextView in Android. android:id-ID is an attribute used to define a TextView uniquely. android: layout_height- Height is the attribute which is used to set the height of the TextView.
Set The Text of The TextView You can set the text to be displayed in the TextView either when declaring it in your layout file, or by using its setText() method. The text is set via the android:text attribute.
TextView tv1 = (TextView)findViewById(R. id. textView1); tv1. setText("Hello"); setContentView(tv1);
To align text in TextView at the center vertically and horizontally we need to make use of gravity attribute. Example 1 : You can use center_vertical | center_horizontal value to set the text at the center of the TextView area.
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.
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