Dave's Brain

Browse - Programming Tips - How can I center two views?

Date: 2017mar8
OS: Android

Q.  How can I center two views?

A.  Give them both layout_weight=1.0 in the layout.

<LinearLayout> <TextView android:layout_weight="1.0"> <TextView android:layout_weight="1.0"> </LinearLayout>
Details omitted for clarity.

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.