Android工作室。在多个复选框和等间距下对齐多个文本框以适合屏幕
Android Studio. Align multiple text boxes under multiple check boxes and equal spacing to fit screen
This is what i am trying to achieve
但
this is what i get when uploaded on phone.
在 android studio 片段设计预览中似乎没问题,但上传到 phone
不显示复选框:(.
有更好的解决方案吗?
下面是完整的 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:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="@string/getnotif"
android:layout_below="@+id/linearLayout5"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/textView"
android:text="@string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toEndOf="@+id/checkBox"
android:layout_toRightOf="@+id/checkBox"
android:text="@string/msms"
android:textSize="12sp" />
<Button
android:id="@+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="@+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="@+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="@+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:orientation="horizontal"
android:layout_alignRight="@+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="@string/monday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/tuesday"
android:paddingLeft="-26dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/wednesday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/thursday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/friday"
android:paddingLeft="-24dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="@string/saturday"
android:paddingLeft="-25dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:text="@string/sunday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="@+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="@+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="@+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/from"
android:layout_below="@+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="@+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/to"
android:layout_below="@+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout5"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_below="@+id/linearLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
</RelativeLayout>
在 LinearLayout 中使用 layout_weight=1 设置所有复选框。将线性布局的方向设置为垂直。
<?xml version="1.0" encoding="utf-8"?>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mon"
android:layout_weight="1"
android:id="@+id/checkBox"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tue"
android:layout_weight="1"
android:id="@+id/checkBox2"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wed"
android:layout_weight="1"
android:id="@+id/checkBox3"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Thu"
android:layout_weight="1"
android:id="@+id/checkBox4"/>
I have tested your design in an activity , it's displaying fine in full screen.
[![like this][1]][1]
[1]: http://i.stack.imgur.com/0B1hz.png
Make sure you have given Fragment width and height to match parent.
<Fragment
android:width="match_parent"
android:height="match_parent"
/>
New androidtudio preview
和
the result on phone
下面的代码已按照您的建议进行了修改。
<?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:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="@string/getnotif"
android:layout_below="@+id/linearLayout2"
android:layout_centerHorizontal="true" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/textView"
android:text="@string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toEndOf="@+id/checkBox"
android:layout_toRightOf="@+id/checkBox"
android:text="@string/msms"
android:textSize="12sp" />
<Button
android:id="@+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="@+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="@+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="@+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:orientation="vertical"
android:layout_alignRight="@+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MON"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TUE"
android:layout_weight="1"/>
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WED"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="THU"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FRI"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAT"
android:layout_weight="1"/>
<CheckBox
android:id="@+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SUN"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="@+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="@+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="@+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/from"
android:layout_below="@+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="@+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/to"
android:layout_below="@+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
</RelativeLayout>
我没能正确对齐复选框下方的文本框。
我已将布局插入到滚动视图中,我可以正确地看到他们都知道。
这对我来说已经足够好了。
This is what i am trying to achieve 但 this is what i get when uploaded on phone.
在 android studio 片段设计预览中似乎没问题,但上传到 phone 不显示复选框:(.
有更好的解决方案吗?
下面是完整的 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:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="@string/getnotif"
android:layout_below="@+id/linearLayout5"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/textView"
android:text="@string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toEndOf="@+id/checkBox"
android:layout_toRightOf="@+id/checkBox"
android:text="@string/msms"
android:textSize="12sp" />
<Button
android:id="@+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="@+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="@+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="@+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:orientation="horizontal"
android:layout_alignRight="@+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="@string/monday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/tuesday"
android:paddingLeft="-26dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/wednesday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/thursday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="@string/friday"
android:paddingLeft="-24dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="@string/saturday"
android:paddingLeft="-25dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="@+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:text="@string/sunday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="@+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="@+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="@+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/from"
android:layout_below="@+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="@+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/to"
android:layout_below="@+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout5"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_below="@+id/linearLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
</RelativeLayout>
在 LinearLayout 中使用 layout_weight=1 设置所有复选框。将线性布局的方向设置为垂直。
<?xml version="1.0" encoding="utf-8"?>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mon"
android:layout_weight="1"
android:id="@+id/checkBox"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tue"
android:layout_weight="1"
android:id="@+id/checkBox2"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wed"
android:layout_weight="1"
android:id="@+id/checkBox3"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Thu"
android:layout_weight="1"
android:id="@+id/checkBox4"/>
I have tested your design in an activity , it's displaying fine in full screen.
[![like this][1]][1]
[1]: http://i.stack.imgur.com/0B1hz.png
Make sure you have given Fragment width and height to match parent.
<Fragment
android:width="match_parent"
android:height="match_parent"
/>
New androidtudio preview 和 the result on phone
下面的代码已按照您的建议进行了修改。
<?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:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="@string/getnotif"
android:layout_below="@+id/linearLayout2"
android:layout_centerHorizontal="true" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/textView"
android:text="@string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toEndOf="@+id/checkBox"
android:layout_toRightOf="@+id/checkBox"
android:text="@string/msms"
android:textSize="12sp" />
<Button
android:id="@+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="@+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="@+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="@+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:orientation="vertical"
android:layout_alignRight="@+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MON"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TUE"
android:layout_weight="1"/>
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WED"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="THU"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FRI"
android:layout_weight="1" />
<CheckBox
android:id="@+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAT"
android:layout_weight="1"/>
<CheckBox
android:id="@+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SUN"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="@+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="@+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="@+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/from"
android:layout_below="@+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="@+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/to"
android:layout_below="@+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
</RelativeLayout>
我没能正确对齐复选框下方的文本框。 我已将布局插入到滚动视图中,我可以正确地看到他们都知道。 这对我来说已经足够好了。