Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center align a view?

I need to lay a variable number of views (may just be one) next to each other like in LinearLayout. But I want the whole arrangement to be center aligned. The views should be next to each other. But the whole arrangement should be equidistant from the left and right edge of the screen or the containing parent. How can I accomplish this?

like image 853
Raj Avatar asked Jun 10 '11 15:06

Raj


1 Answers

Did you try

      android:gravity="center" 

?

like image 200
dmon Avatar answered Sep 16 '22 15:09

dmon