user3705478 user3705478 - 15 days ago 6
Android Question

When should I use layout_centerHorizontal=true and gravity="center_horizonatal" and foregroundGravity="centerHorizontal"?

I read the documentation, but I am not able get when should I use which?

Answer

When you use RelativeLayout - You should use layout_centerHorizontal,layout_centerVertical,layout_centerInParent

but when you use LinearLayout , you should use gravity to align children i.e., layout_gravity and gravity.

foregroundGravity is used with foreground tag. What is in foreground it will align according to foregroundGravity

Comments