Android 在RelativeLayout中不能将视图放置在屏幕底部
我想用屏幕底部的注册按钮,但它不允许我在图中显示的黑线底部放置任何视图。有人能告诉我为什么吗 userSignin.xmlAndroid 在RelativeLayout中不能将视图放置在屏幕底部,android,xml,android-layout,Android,Xml,Android Layout,我想用屏幕底部的注册按钮,但它不允许我在图中显示的黑线底部放置任何视图。有人能告诉我为什么吗 userSignin.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:fillViewport="false">
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SignUp"
android:id="@+id/tv_signup"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_marginTop="33dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Username :"
android:id="@+id/tv_username"
android:layout_below="@+id/tv_signup"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/et_username"
android:layout_above="@+id/CB_bbq"
android:layout_toEndOf="@+id/CB_bbq" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:id="@+id/btn_signup"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
<CheckBox
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chinese"
android:id="@+id/CB_chinese"
android:checked="false"
android:layout_below="@+id/CB_bbq"
android:layout_toStartOf="@+id/tv_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FastFood"
android:id="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_chinese"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<CheckBox
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBQ"
android:id="@+id/CB_bbq"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese"
android:layout_below="@+id/tv_username" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pizza"
android:id="@+id/CB_pizza"
android:checked="false"
android:layout_alignEnd="@+id/CB_fastfood"
android:layout_alignStart="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_bbq" />
<TextView
android:textSize="17dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select KM at which you notify for any ALert"
android:id="@+id/textView2"
android:layout_below="@+id/CB_chinese"
android:layout_alignParentStart="true" />
<TextView
android:textSize="17dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select interested time"
android:id="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Breakfast"
android:id="@+id/CB_bf"
android:layout_below="@+id/textView3"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brunch"
android:id="@+id/CB_brunch"
android:layout_alignTop="@+id/CB_bf"
android:checked="false"
android:layout_alignStart="@+id/CB_fastfood" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch"
android:id="@+id/CB_lunch"
android:layout_below="@+id/CB_bf"
android:layout_alignStart="@+id/CB_bf"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Tea"
android:id="@+id/checkBox8"
android:layout_below="@+id/CB_bf"
android:layout_toEndOf="@+id/btn_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dinner"
android:id="@+id/CB_dinner"
android:layout_below="@+id/CB_lunch"
android:layout_alignStart="@+id/CB_lunch"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Midnight Deals"
android:id="@+id/CB_md"
android:layout_below="@+id/checkBox8"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<TextView
android:textSize="17dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select Food Type"
android:id="@+id/textView"
android:layout_above="@+id/CB_pizza" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_km"
android:layout_alignBaseline="@+id/CB_dinner"
android:layout_alignBottom="@+id/CB_dinner"
android:layout_alignEnd="@+id/CB_md" />
</RelativeLayout>
</ScrollView>
/>
将按钮放在滚动视图外。将按钮放在滚动视图外。尝试此代码
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SignUp"
android:id="@+id/tv_signup"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_marginTop="33dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Username :"
android:id="@+id/tv_username"
android:layout_below="@+id/tv_signup"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/et_username"
android:layout_above="@+id/CB_bbq"
android:layout_toEndOf="@+id/CB_bbq" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:id="@+id/btn_signup"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
<CheckBox
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chinese"
android:id="@+id/CB_chinese"
android:checked="false"
android:layout_below="@+id/CB_bbq"
android:layout_toStartOf="@+id/tv_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FastFood"
android:id="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_chinese"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<CheckBox
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBQ"
android:id="@+id/CB_bbq"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese"
android:layout_below="@+id/tv_username" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pizza"
android:id="@+id/CB_pizza"
android:checked="false"
android:layout_alignEnd="@+id/CB_fastfood"
android:layout_alignStart="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_bbq" />
<TextView
android:textSize="17dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select KM at which you notify for any ALert"
android:id="@+id/textView2"
android:layout_below="@+id/CB_chinese"
android:layout_alignParentStart="true" />
<TextView
android:textSize="17dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select interested time"
android:id="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Breakfast"
android:id="@+id/CB_bf"
android:layout_below="@+id/textView3"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brunch"
android:id="@+id/CB_brunch"
android:layout_alignTop="@+id/CB_bf"
android:checked="false"
android:layout_alignStart="@+id/CB_fastfood" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch"
android:id="@+id/CB_lunch"
android:layout_below="@+id/CB_bf"
android:layout_alignStart="@+id/CB_bf"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Tea"
android:id="@+id/checkBox8"
android:layout_below="@+id/CB_bf"
android:layout_toEndOf="@+id/btn_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dinner"
android:id="@+id/CB_dinner"
android:layout_below="@+id/CB_lunch"
android:layout_alignStart="@+id/CB_lunch"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Midnight Deals"
android:id="@+id/CB_md"
android:layout_below="@+id/checkBox8"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<TextView
android:textSize="17dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select Food Type"
android:id="@+id/textView"
android:layout_above="@+id/CB_pizza" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_km"
android:layout_alignBaseline="@+id/CB_dinner"
android:layout_alignBottom="@+id/CB_dinner"
android:layout_alignEnd="@+id/CB_md" />
</RelativeLayout>
</ScrollView>
试试这段代码
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SignUp"
android:id="@+id/tv_signup"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_marginTop="33dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Username :"
android:id="@+id/tv_username"
android:layout_below="@+id/tv_signup"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/et_username"
android:layout_above="@+id/CB_bbq"
android:layout_toEndOf="@+id/CB_bbq" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:id="@+id/btn_signup"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
<CheckBox
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chinese"
android:id="@+id/CB_chinese"
android:checked="false"
android:layout_below="@+id/CB_bbq"
android:layout_toStartOf="@+id/tv_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FastFood"
android:id="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_chinese"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<CheckBox
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBQ"
android:id="@+id/CB_bbq"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese"
android:layout_below="@+id/tv_username" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pizza"
android:id="@+id/CB_pizza"
android:checked="false"
android:layout_alignEnd="@+id/CB_fastfood"
android:layout_alignStart="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_bbq" />
<TextView
android:textSize="17dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select KM at which you notify for any ALert"
android:id="@+id/textView2"
android:layout_below="@+id/CB_chinese"
android:layout_alignParentStart="true" />
<TextView
android:textSize="17dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select interested time"
android:id="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Breakfast"
android:id="@+id/CB_bf"
android:layout_below="@+id/textView3"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brunch"
android:id="@+id/CB_brunch"
android:layout_alignTop="@+id/CB_bf"
android:checked="false"
android:layout_alignStart="@+id/CB_fastfood" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch"
android:id="@+id/CB_lunch"
android:layout_below="@+id/CB_bf"
android:layout_alignStart="@+id/CB_bf"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Tea"
android:id="@+id/checkBox8"
android:layout_below="@+id/CB_bf"
android:layout_toEndOf="@+id/btn_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dinner"
android:id="@+id/CB_dinner"
android:layout_below="@+id/CB_lunch"
android:layout_alignStart="@+id/CB_lunch"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Midnight Deals"
android:id="@+id/CB_md"
android:layout_below="@+id/checkBox8"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<TextView
android:textSize="17dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select Food Type"
android:id="@+id/textView"
android:layout_above="@+id/CB_pizza" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_km"
android:layout_alignBaseline="@+id/CB_dinner"
android:layout_alignBottom="@+id/CB_dinner"
android:layout_alignEnd="@+id/CB_md" />
</RelativeLayout>
</ScrollView>
在Scrollview中,当Scrollview包装内容时,如果未标记fillViewport=“true”,则需要使用
android:fillViewport=“true”
而不是false推理,并将可用区域保留为未使用
/>
在Scrollview中,当Scrollview包装内容时,如果未标记fillViewport=“true”,则需要使用android:fillViewport=“true”
而不是false推理,并将可用区域保留为未使用
/>
尝试更改行android:fillViewport=“true”
尝试更改行android:fillViewport=“true”
删除layout\u gravity=“center”
删除注册按钮的此行
android:layout_gravity="center"
换上这个按钮
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:id="@+id/btn_signup"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
希望它对您有用。删除
layout\u gravity=“center”
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SignUp"
android:id="@+id/tv_signup"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_marginTop="33dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Username :"
android:id="@+id/tv_username"
android:layout_below="@+id/tv_signup"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/et_username"
android:layout_above="@+id/CB_bbq"
android:layout_toEndOf="@+id/CB_bbq" />
<CheckBox
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chinese"
android:id="@+id/CB_chinese"
android:checked="false"
android:layout_below="@+id/CB_bbq"
android:layout_toStartOf="@+id/tv_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FastFood"
android:id="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_chinese"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<CheckBox
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBQ"
android:id="@+id/CB_bbq"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese"
android:layout_below="@+id/tv_username" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pizza"
android:id="@+id/CB_pizza"
android:checked="false"
android:layout_alignEnd="@+id/CB_fastfood"
android:layout_alignStart="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_bbq" />
<TextView
android:textSize="17dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select KM at which you notify for any ALert"
android:id="@+id/textView2"
android:layout_below="@+id/CB_chinese"
android:layout_alignParentStart="true" />
<TextView
android:textSize="17dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select interested time"
android:id="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Breakfast"
android:id="@+id/CB_bf"
android:layout_below="@+id/textView3"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brunch"
android:id="@+id/CB_brunch"
android:layout_alignTop="@+id/CB_bf"
android:checked="false"
android:layout_alignStart="@+id/CB_fastfood" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch"
android:id="@+id/CB_lunch"
android:layout_below="@+id/CB_bf"
android:layout_alignStart="@+id/CB_bf"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Tea"
android:id="@+id/checkBox8"
android:layout_below="@+id/CB_bf"
android:layout_toEndOf="@+id/btn_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dinner"
android:id="@+id/CB_dinner"
android:layout_below="@+id/CB_lunch"
android:layout_alignStart="@+id/CB_lunch"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Midnight Deals"
android:id="@+id/CB_md"
android:layout_below="@+id/checkBox8"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<TextView
android:textSize="17dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select Food Type"
android:id="@+id/textView"
android:layout_above="@+id/CB_pizza" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_km"
android:layout_alignBaseline="@+id/CB_dinner"
android:layout_alignBottom="@+id/CB_dinner"
android:layout_alignEnd="@+id/CB_md" />
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="bottom"
android:gravity="bottom|center"
>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:gravity="center"
android:id="@+id/btn_signup"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
</LinearLayout>
</LinearLayout>
删除注册按钮的此行
android:layout_gravity="center"
换上这个按钮
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:id="@+id/btn_signup"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
希望它对您有用。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SignUp"
android:id="@+id/tv_signup"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_marginTop="33dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Username :"
android:id="@+id/tv_username"
android:layout_below="@+id/tv_signup"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/et_username"
android:layout_above="@+id/CB_bbq"
android:layout_toEndOf="@+id/CB_bbq" />
<CheckBox
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chinese"
android:id="@+id/CB_chinese"
android:checked="false"
android:layout_below="@+id/CB_bbq"
android:layout_toStartOf="@+id/tv_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FastFood"
android:id="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_chinese"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<CheckBox
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBQ"
android:id="@+id/CB_bbq"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese"
android:layout_below="@+id/tv_username" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pizza"
android:id="@+id/CB_pizza"
android:checked="false"
android:layout_alignEnd="@+id/CB_fastfood"
android:layout_alignStart="@+id/CB_fastfood"
android:layout_alignTop="@+id/CB_bbq" />
<TextView
android:textSize="17dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select KM at which you notify for any ALert"
android:id="@+id/textView2"
android:layout_below="@+id/CB_chinese"
android:layout_alignParentStart="true" />
<TextView
android:textSize="17dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select interested time"
android:id="@+id/textView3"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Breakfast"
android:id="@+id/CB_bf"
android:layout_below="@+id/textView3"
android:checked="false"
android:layout_alignStart="@+id/CB_chinese" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brunch"
android:id="@+id/CB_brunch"
android:layout_alignTop="@+id/CB_bf"
android:checked="false"
android:layout_alignStart="@+id/CB_fastfood" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch"
android:id="@+id/CB_lunch"
android:layout_below="@+id/CB_bf"
android:layout_alignStart="@+id/CB_bf"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Tea"
android:id="@+id/checkBox8"
android:layout_below="@+id/CB_bf"
android:layout_toEndOf="@+id/btn_signup" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dinner"
android:id="@+id/CB_dinner"
android:layout_below="@+id/CB_lunch"
android:layout_alignStart="@+id/CB_lunch"
android:checked="false" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Midnight Deals"
android:id="@+id/CB_md"
android:layout_below="@+id/checkBox8"
android:layout_toEndOf="@+id/btn_signup"
android:checked="false" />
<TextView
android:textSize="17dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Select Food Type"
android:id="@+id/textView"
android:layout_above="@+id/CB_pizza" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_km"
android:layout_alignBaseline="@+id/CB_dinner"
android:layout_alignBottom="@+id/CB_dinner"
android:layout_alignEnd="@+id/CB_md" />
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="bottom"
android:gravity="bottom|center"
>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:gravity="center"
android:id="@+id/btn_signup"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/CB_chinese" />
</LinearLayout>
</LinearLayout>
将android:fillViewport=“true”放在滚动视图的父对象上,并将RelativeLayout设置为滚动视图的父对象将android:fillViewport=“true”放在滚动视图的父对象上,并将RelativeLayout设置为scrollview@android请看一下我的答案。希望它能解决您的问题。fillViewPost=“true”将android:fillViewport=“true”设置为scrollview@android请看一下我的答案。希望它能解决你的问题。scrollview是那里的家长,他怎么能把scrollview保持在外面?这些小东西应该在评论中提及。使用另一个家长布局,例如线性布局,并在放置按钮之后放入scrollview。不是这样,我只需更改android:fillViewport=“false”“真的”scrollview是那里的父级,他怎么能保持scrollview之外的状态呢?这些小东西应该在评论中提及。使用另一个父级布局,例如线性布局,然后将scrollview放入该布局按钮中。不是这样,我只需将android:fillViewport=“false”更改为“true”