I'm following an online tutorial about Android Studio. But in the video clip, the instructor use textAlignment which is under textAppearance which is under textView under Attributes. In Design View. I looked on the developer website but couldn't find the answer. In my Android Studio 3.1.2, it stops with textStyle (B,I,Tt). I would like to add this function to my attributes.
Screenshot from instructor video
To right align text in TextView in Kotlin Android, set android:textAlignment attribute with the value “viewEnd” in layout file, or programmatically set the textAlignment property of the TextView object with View.
android:gravity="center" for text center in TextView. android:gravity="center_horizontal" inner text if you want horizontally centered. android:gravity="center_vertical" inner text if you want vertically centered. android:layout_centerInParent="true" if you want TextView in center position of parent view.
To left align the text in this Textview through layout file, set the android:textAlignment attribute for the TextView to “viewStart”, as shown in the following activity_main. xml layout file.
So the gravity attribute specifies how to align the text inside the TextView layout_gravity specifies how to align/layout the TextView element itself.
You can not, there is no option for it but you can handle this by using "View All Attributes" -> "gravity". Click the text and then click the "View All Attributes" at the bottom of the options sidebar.
Then look for "gravity" or search. Then pick the options you want.
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