我有两个CardView的布局。每个人的右下方都有一个FAB。 POrtrait工作得很好,但在景观中第二个CardView的FAB"断开"并滚动布局。你知道我的错误在哪里吗?
<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=".MainActivity">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/cv2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:layout_margin="20dp"
android:layout_marginTop="50dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_persistent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textOff=""
android:textOn="" />
<TextView
android:id="@+id/tv_persistent_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/persistent_reminder"
android:textSize="@dimen/abc_text_size_large_material" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="15dp"
android:paddingTop="10dp"
android:text="@string/reminder"
android:textColor="@android:color/black"
android:textSize="@dimen/abc_text_size_large_material"
android:textStyle="italic" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/cv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:layout_margin="20dp"
android:layout_marginTop="50dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_startup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textOff=""
android:textOn="" />
<TextView
android:id="@+id/tv_startup_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/startup_reminder"
android:textSize="@dimen/abc_text_size_large_material" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/tv_startup_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="15dp"
android:paddingTop="10dp"
android:text="@string/reminder"
android:textColor="@android:color/black"
android:textSize="@dimen/abc_text_size_large_material"
android:textStyle="italic" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_startup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:src="@drawable/pencil"
app:backgroundTint="@color/accentColor"
app:borderWidth="0dp"
app:elevation="8dp"
app:layout_anchor="@id/cv"
app:layout_anchorGravity="end|bottom"
app:pressedTranslationZ="12dp"
app:rippleColor="@android:color/white" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_persistent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:src="@drawable/pencil"
app:backgroundTint="@color/accentColor"
app:borderWidth="0dp"
app:elevation="8dp"
app:layout_anchor="@id/cv2"
app:layout_anchorGravity="end|bottom"
app:pressedTranslationZ="12dp"
app:rippleColor="@android:color/white" />
</android.support.design.widget.CoordinatorLayout>