I was going through documentation of android:textAlignment and it has 7 options few of those are viewEnd/viewStart and textEnd/textStart
I could not understand what is difference in view#### vs text#### using docs from the POV of use cases.If anyone can clarify that in more detail using some examples or use cases?
value class TextAlign. Defines how to align text horizontally. TextAlign controls how text aligns in the space it appears.
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.
To center align text in TextView in Kotlin Android, set android:textAlignment attribute with the value “center” in layout file, or programmatically set the textAlignment property of the TextView object with View. TEXT_ALIGNMENT_CENTER in activity file.
Just to add, if you want center justification, you can do android:layout_gravity="center_horizontal|center" android:gravity="center" .
My observation,
if the textDirection or layoutDirection is ltr then, viewStart/End and textStart/End behaves the same.
But if you change one of the textDirection or layoutDirection to rtl, and now try the view/text start/end, you will visually see the difference.

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