Skip to content

Instantly share code, notes, and snippets.

@chayanbobra13
Created May 8, 2018 10:30
Show Gist options
  • Save chayanbobra13/04428118ece85c60708b161e26287a4f to your computer and use it in GitHub Desktop.
Save chayanbobra13/04428118ece85c60708b161e26287a4f to your computer and use it in GitHub Desktop.
This is my XML code which i have created for my random number generator game.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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="com.example.android.rg.gameActivity"
android:background="#E0F7FA" >
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#B2DFDB"
android:padding="5dp"
android:text="@string/enter_number_from_1_to_50"
android:textColor="#757575"
android:textSize="30sp"
android:textStyle="italic|bold" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView"
android:background="#60B2DFDB"
android:textColor="#757575"
android:gravity="center"
android:padding="10dp"
android:text="@string/can_you_guess_the_number"
android:textSize="20sp"
android:textStyle="italic|bold" />
<EditText
android:id="@+id/guessEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/hint"
android:layout_marginTop="38dp"
android:ems="10"
android:gravity="center"
android:hint="@string/enter_number_here"
android:inputType="number"
android:padding="10dp" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/guessEditText"
android:layout_marginTop="20dp"
android:background="#5080DEEA"
android:gravity="center"
android:onClick="guess"
android:text="Make Your Guess "
android:textSize="14sp" />
<ImageView
android:id="@+id/share"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="14dp"
android:src="@drawable/as"
android:foregroundGravity="center"/>
<ImageView
android:id="@+id/play"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/hint"
android:layout_alignStart="@+id/hint"
android:layout_below="@+id/resultEditText"
android:onClick="playButton"
android:src="@drawable/ic_play_circle_filled_black_48dp" />
<ImageView
android:id="@+id/hint"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView2"
android:foregroundGravity="right"
android:onClick="hintButton"
android:src="@drawable/q_512" />
<EditText
android:id="@+id/resultEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/resultTextView"
android:layout_marginTop="20dp"
android:ems="10"
android:gravity="center"
android:hint="Check your result.."
android:inputType="none"
android:padding="10dp" />
<TextView
android:id="@+id/resultTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/button"
android:layout_marginTop="20dp"
android:background="#60B2DFDB"
android:padding="10dp"
android:text="Result :"
android:textColor="#757575"
android:textSize="20dp"
android:textStyle="italic|bold" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment