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?
Share
You will have to wrap your views inside a
LinearLayoutand your linear layout inside something else:Make sure all your views use
android:layout_width="wrap_content". If you are working withRelativeLayout, it will be: