问题描述
在这里我使用了滚动视图,我想在页面底部留一个空格,这样只有条款和条件可以滚动,并且复选框和按钮不能滚动,它应该在页面底部,您可以帮我吗xml。我已经附加了一张我想要这样的图像,其中底部的按钮不会移动Design Example herea
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Common.PolcyPage"> <LinearLayout android:id="@+id/liner_layout_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="35dp" android:layout_marginLeft="35dp" android:layout_marginTop="60dp" android:fontFamily="@font/segoe_ui_bold" android:text="@string/terms_of_services" android:textColor="@color/colorTandC" android:textSize="25sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="35dp" android:layout_marginLeft="35dp" android:text="@string/updated_date_terms" android:textColor="@color/colorTandC_titles" /> <LinearLayout android:layout_width="match_parent" android:layout_height="2dp" android:layout_marginTop="38dp" android:background="@color/colorTandC_desc" /> </LinearLayout> <ScrollView android:scrollbars="none" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="35dp" android:layout_marginLeft="35dp" android:layout_marginTop="35dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="@font/segoe_ui_semibold" android:text="@string/terms_one_title" android:textColor="@color/colorTandC_titles" android:textSize="14sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginEnd="30dp" android:layout_marginRight="30dp" android:text="@string/terms_one_desc" android:textColor="@color/colorTandC_desc" android:textSize="13sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:fontFamily="@font/segoe_ui_semibold" android:text="@string/terms_two_title" android:textColor="@color/colorTandC_titles" android:textSize="14sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginEnd="30dp" android:layout_marginRight="30dp" android:text="@string/terms_two_desc" android:textColor="@color/colorTandC_desc" android:textSize="13sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="25dp" android:layout_marginLeft="25dp" android:layout_marginEnd="30dp" android:layout_marginRight="30dp" android:text="@string/terms_two_desc_terms" android:textColor="@color/colorTandC_desc" android:textSize="13sp" /> </LinearLayout> </ScrollView> </LinearLayout> </RelativeLayout>
@H_404_5@解决方法
如果我正确理解了您的问题,则可以这样处理:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/bottom_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="32dp" android:paddingRight="32dp" android:gravity="center" android:orientation="horizontal"> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:text="I agree with the Terms and Conditions"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="32dp" android:paddingRight="32dp" android:gravity="center" android:orientation="horizontal"> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:text="I agree with the Privacy Policy"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="32dp" android:paddingRight="32dp" android:paddingTop="16dp" android:paddingBottom="32dp" android:orientation="horizontal"> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:layout_marginRight="32dp" android:text="decline"/> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:text="accept"/> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/top_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="32dp" android:paddingRight="32dp" android:paddingTop="16dp" android:paddingBottom="8dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="70dp" android:layout_height="70dp" android:src="@drawable/your_image"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:text="Terms of service"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Update date"/> </LinearLayout> </LinearLayout> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@id/bottom_parent" android:layout_below="@id/top_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- ADD YOUR TEXTVIEWS HERE --> </LinearLayout> </ScrollView>
使用android:layout_above和android:layout_below定义您的ScrollView位置
,尝试在屏幕底部甚至滚动视图的下方添加按钮
在scrollView或Parent LinearLayout中添加此石灰
<ScrollView> android:layout_above="@+id/bottom_panel"
将此添加到xml的最底部
</ScrollView> </LinearLayout> --------------- ADD HERE - Below Scroll View ------- <LinearLayout android:id="@+id/bottom_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center|bottom" OR android:layout_alignParentBottom="true" android:orientation="horizontal"> <Button android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:text="Decline"/> <Button android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:text="Accept"/> </LinearLayout> </RelativeLayout>
让我知道它是否工作正常