Skip to content

Instantly share code, notes, and snippets.

@vpluma
Created December 14, 2015 09:50
Show Gist options
  • Save vpluma/d35d94a71c9793306b5e to your computer and use it in GitHub Desktop.
Save vpluma/d35d94a71c9793306b5e to your computer and use it in GitHub Desktop.
Activity_Main.xml for the Just Java app - Udacity.com (Android Development for Beginners)
<ScrollView
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="#4D3930"
android:src="@drawable/javalogo" />
<EditText
android:id="@+id/name_field"
android:hint="@string/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_marginBottom="16dp"
android:backgroundTint="#d26c1a"
android:maxLength="30">
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/toppings"
style="@style/CustomText"
android:textAllCaps="true"
android:textColor="@android:color/black" />
<CheckBox
android:id="@+id/whipped_cream_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="16dp"
android:buttonTint="#d26c1a"
android:text="@string/whipped_cream"/>
<CheckBox
android:id="@+id/chocolate_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="16dp"
android:buttonTint="#d26c1a"
android:text="@string/chocolate"/>
<CheckBox
android:id="@+id/marshmallow_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="16dp"
android:buttonTint="#d26c1a"
android:text="@string/marshmallow"/>
<CheckBox
android:id="@+id/caramel_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:paddingLeft="5dp"
android:textSize="16dp"
android:buttonTint="#d26c1a"
android:text="@string/caramel"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/quantity"
style="@style/CustomText"
android:textAllCaps="true"
android:textColor="@android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:onClick="decrement"
android:text="-"
android:textSize="16sp" />
<TextView
android:id="@+id/quantity_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="1"
android:textColor="@android:color/black"
android:textSize="16sp" />
<Button
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:onClick="increment"
android:text="+"
android:textSize="16sp" />
</LinearLayout>
<!--
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Order Summary"
android:textAllCaps="true"
android:textColor="@android:color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/order_summary_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$0"
android:textAllCaps="false"
android:textColor="@android:color/black"
android:textSize="16sp" />
-->
<EditText
android:id="@+id/creditcard_field"
android:hint="@string/cardnumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:backgroundTint="#d26c1a"
android:maxLength="30">
</EditText>
<EditText
android:id="@+id/expiration_field"
android:hint="@string/expiration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:backgroundTint="#d26c1a"
android:maxLength="30">
</EditText>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:onClick="submitOrder"
android:text="@string/order" />
</LinearLayout>
</ScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment