我实现NonSwipeableViewPager一个片段具有NestedScrollView这个样子,我想到的是,滚动视图可以滚动起来,并显示2个textviews:NestedScrollView无法match_parent高度子滚动
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/header" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_up" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 2" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
但它不能滚动,我尝试了很多方法,但仍然没有得到任何解决方案
滚动型需要他们的孩子的身高被WRAP_CONTENT –
@TimCastelijns,所以我们没有任何的方式与match_parent高度来完成它,我们呢? –
这就是滚动视图的工作方式,你可以设置滚动视图来匹配父窗口,但不是scrollview的子窗口,需要包装内容 –