Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created September 20, 2020 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingwithsara/168d96b0f91286e86265121499e58872 to your computer and use it in GitHub Desktop.
Save codingwithsara/168d96b0f91286e86265121499e58872 to your computer and use it in GitHub Desktop.
Catch the Ball - Android Studio Game Tutorial - Bonus #3
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="#f3f3f3">
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="330dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/box"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/box_right"/>
</FrameLayout>
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="3"
android:rowCount="3"
android:layout_marginTop="20dp">
<Button
android:id="@+id/upBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Up"
android:layout_column="1"
android:layout_row="0"/>
<Button
android:id="@+id/leftBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Left"
android:layout_column="0"
android:layout_row="1"/>
<Button
android:id="@+id/rightBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Right"
android:layout_column="2"
android:layout_row="1"/>
<Button
android:id="@+id/downBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Down"
android:layout_column="1"
android:layout_row="2"/>
</GridLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment