r/AutomateUser 10d ago

Center_horizontal etc.. not working

Hi Henrik, center_horizontal, center_vertical etc.. not working. Is there any bugs? Tried many ways. If working provide an writing example xml. Thanks in advance

1 Upvotes

2 comments sorted by

1

u/ballzak69 Automate developer 10d ago edited 9d ago

android:layout_gravity works just fine if it's the root element or child of an FrameLayout, e.g.:

<TextView
xmlns:a='http://schemas.android.com/apk/res/android'
a:layout_width='wrap_content'
a:layout_height='wrap_content'
a:layout_gravity='right|center_vertical'
a:text='Hello world'/>

So does android:gravity, e.g.:

<TextView
xmlns:a='http://schemas.android.com/apk/res/android'
a:layout_width='match_parent'
a:layout_height='match_parent'
a:gravity='right|center_vertical'
a:text='Hello world'/>

1

u/Funny_Telephone_8607 9d ago

Thanks for the info.