Skip to content

Instantly share code, notes, and snippets.

@samwize
Created October 10, 2013 15:19
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 samwize/6920169 to your computer and use it in GitHub Desktop.
Save samwize/6920169 to your computer and use it in GitHub Desktop.
Stopwatch layout
<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"
tools:context=".MainActivity">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="@drawable/background"
android:clickable="false">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="left|top">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="00:00.0"
android:gravity="center"
android:id="@+id/timerTextView"
android:layout_alignParentTop="true"
android:layout_alignLeft="@+id/startStopButton"
android:layout_marginTop="18dp"
android:textSize="60sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_margin="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:id="@+id/startStopButton"
android:onClick="startStopClick"
android:layout_alignTop="@+id/resetButton"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:textSize="30sp"
android:background="@drawable/startbutton" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reset"
android:id="@+id/resetButton"
android:onClick="resetClick"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/startStopButton"
android:layout_weight="1"
android:textSize="30sp"
android:background="@drawable/resetbutton" />
</LinearLayout>
</RelativeLayout>
</FrameLayout>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment