我已将FrameLayout
用作Fragment
内的NestedScrollView
容器。在Fragment
中首先加载FrameLayout
(滚动)时,它工作正常,但是当我在Fragment
中替换另一个FrameLayout
时,它也停止显示内容并滚动
我尝试在android:fillViewport="true"
中设置属性NestedScrollview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ImageView
android:id="@+id/imgProfile"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/icon_profile_image"
app:layout_constraintEnd_toStartOf="@+id/txtName"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/icon_add_round"
app:layout_constraintBottom_toBottomOf="@+id/imgProfile"
app:layout_constraintEnd_toEndOf="@+id/imgProfile" />
<TextView
android:id="@+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:maxLines="2"
android:textColor="@color/text_dark"
android:textSize="18dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/imgProfile"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/imgProfile"
app:layout_constraintTop_toTopOf="@+id/imgProfile" />
</android.support.constraint.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="@dimen/_10sdp"
android:background="@color/app_yellow" />
<FrameLayout
android:id="@+id/containerMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
我想滚动为Fragment
内容,但只能在第一次使用