Created
July 28, 2012 10:14
-
-
Save chrishuan9/3192782 to your computer and use it in GitHub Desktop.
50/50 Layout Split with RelativeLayout in Android by using an invisible View and centering it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content"> | |
<View android:id="@+id/strut" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_centerHorizontal="true"/> | |
<Button | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_alignRight="@id/strut" | |
android:layout_alignParentLeft="true" | |
android:text="Left"/> | |
<Button | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_alignLeft="@id/strut" | |
android:layout_alignParentRight="true" | |
android:text="Right"/> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome solution.. thank you man.