-
-
Save chrjen/61f63e23f313b0d29a72 to your computer and use it in GitHub Desktop.
Android button swap layout
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 xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
tools:context=".MainActivity"><![CDATA[ | |
TextView | |
android:text="@string/hello_world" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textView"/> | |
]]> | |
<FrameLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true"> | |
<GridLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_gravity="center_horizontal|top" | |
android:columnCount="2" | |
android:rowCount="2"> | |
<FrameLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/textView" | |
android:id="@+id/frameLayout" | |
android:layout_gravity="left|center_vertical" | |
android:layout_row="0" | |
android:layout_column="0"> | |
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Button1" | |
android:id="@+id/button" | |
android:layout_gravity="center_horizontal|top" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/button2" | |
android:layout_toEndOf="@+id/button2" | |
android:onClick="buttonClicked"/> | |
</FrameLayout> | |
<FrameLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/frameLayout" | |
android:layout_toEndOf="@+id/frameLayout" | |
android:id="@+id/frameLayout2" | |
android:layout_gravity="center" | |
android:layout_row="0" | |
android:layout_column="1"> | |
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Button2" | |
android:id="@+id/button2" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/frameLayout" | |
android:layout_toEndOf="@+id/frameLayout" | |
android:onClick="buttonClicked"/> | |
</FrameLayout> | |
<FrameLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_below="@+id/frameLayout" | |
android:layout_alignParentLeft="true" | |
android:layout_alignParentStart="true" | |
android:id="@+id/frameLayout3" | |
android:layout_gravity="left|bottom" | |
android:layout_row="1" | |
android:layout_column="0"> | |
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Button3" | |
android:id="@+id/button3" | |
android:layout_below="@+id/frameLayout" | |
android:layout_alignParentLeft="true" | |
android:layout_alignParentStart="true" | |
android:onClick="buttonClicked"/> | |
</FrameLayout> | |
<FrameLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignTop="@+id/frameLayout3" | |
android:layout_toRightOf="@+id/frameLayout" | |
android:layout_toEndOf="@+id/frameLayout" | |
android:id="@+id/frameLayout4" | |
android:layout_gravity="center_horizontal|bottom" | |
android:layout_row="1" | |
android:layout_column="1"> | |
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Button4" | |
android:id="@+id/button4" | |
android:layout_alignBottom="@+id/button3" | |
android:layout_centerHorizontal="true" | |
android:onClick="buttonClicked"/> | |
</FrameLayout> | |
</GridLayout> | |
</FrameLayout> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment