Dynamic Checkboxes: Layout File
The following view groups and views are used to create the only one UI,
activity_main.xml
, used in this app:
-
RelativeLayout for the whole screen,
-
LinearLayout for the checkboxes of courses,
-
TextView for the text such as “Number:” and “Title:” and the result of the selected checkbox,
-
EditText for the user input, course number and title, and
-
Button for creating a checkbox of a new course.
DynamicCheckbox/app/src/main/res/layout/activity_main.xml
|
|
<?xml version="1.0" encoding="utf-8"?>
<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:paddingBottom = "@dimen/activity_vertical_margin"
android:paddingLeft = "@dimen/activity_horizontal_margin"
android:paddingRight = "@dimen/activity_horizontal_margin"
android:paddingTop = "@dimen/activity_vertical_margin"
tools:context = ".MainActivity">
<EditText
android:id = "@+id/number"
android:ems = "10"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginTop = "30dp"
android:layout_alignParentRight = "true"
android:layout_alignParentTop = "true">
</EditText>
<EditText
android:id = "@+id/title"
android:ems = "10"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignRight = "@+id/number"
android:layout_below = "@+id/number"
android:layout_marginTop = "10dp">
</EditText>
<TextView
android:id = "@+id/textView1"
android:text = "Number:"
android:textColor = "#000044"
android:textStyle = "bold"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginTop = "10dp"
android:layout_alignBottom = "@+id/number"
android:layout_alignParentLeft = "true">
</TextView>
<TextView
android:id = "@+id/textView2"
android:text = "Title:"
android:textStyle = "bold"
android:textColor = "#000044"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignBaseline = "@+id/title"
android:layout_alignBottom = "@+id/title"
android:layout_alignParentLeft = "true">
</TextView>
<TextView
android:id = "@+id/textView3"
android:textColor = "#1a7cff"
android:textStyle = "bold"
android:textSize = "18px"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentTop = "true"
android:layout_centerHorizontal = "true">
</TextView>
<Button
android:id = "@+id/add"
android:text = "Add"
android:background = "#3366CC"
android:textColor = "#ffffff"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_below = "@+id/title"
android:layout_centerHorizontal = "true"
android:layout_marginTop = "10dp">
</Button>
<LinearLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:tools = "http://schemas.android.com/tools"
android:id = "@+id/linearBox"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical"
tools:context = ".MainActivity"
android:layout_below = "@id/add">
</LinearLayout>
</RelativeLayout>
|