这是我必须创建的UI。当用户填写编辑文本时我需要滚动,但按钮必须保持在底部。整个观点搞砸了请帮帮我。视图将滚动,所有ui将不会崩溃
<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"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<EditText
android:id="@+id/frag_login_edt_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<EditText
android:id="@+id/frag_login_edt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/frag_login_edt_email"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
/>
<TextView
android:layout_marginTop="@dimen/dp_30"
android:layout_below="@+id/frag_login_edt_password"
android:id="@+id/frag_login_tv_forgot_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/frag_login_txt_forgot_password"
android:textSize="18sp" />
<include
layout="@layout/social_integration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/frag_login_button_continue_as_guest"
android:id="@+id/include" />
<Button
android:layout_marginTop="@dimen/dp_20"
android:id="@+id/frag_login_button_continue_as_guest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@android:color/white"
android:layout_above="@+id/include"
android:layout_alignParentStart="true"
android:layout_marginBottom="21dp"
android:id="@+id/button" />
</RelativeLayout>
</RelativeLayout>
INclude Code thcode is common so i include it
<?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"
android:orientation="vertical"
android:paddingTop="@dimen/activity_horizontal_margin">
<LinearLayout
android:id="@+id/frag_login_ll_or"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<View
android:id="@+id/frag_view_one"
android:layout_width="@dimen/dp_30"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<TextView
android:id="@+id/frag_view_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_toRightOf="@id/frag_view_one"
android:text="OR" />
<View
android:layout_width="20dp"
android:layout_height="1dp"
android:layout_toRightOf="@id/frag_view_two"
android:background="@android:color/darker_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/frag_login_ll_or"
android:layout_marginTop="@dimen/dp_20">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/facebook" />
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/google" />
</LinearLayout>
</RelativeLayout>
THis is activity\
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:background="@drawable/bg">
<include
layout="@layout/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3">
<include layout="@layout/view_pager" />
</RelativeLayout>
</LinearLayout>
</ScrollView>