我有一个ScrollView,我有一个带有PagerSlidingTabStrip的ViewPager。在ViewPager中,我有一个xml文件,其中包含一些带有长文本的TextView。问题是scrollview不会滚动到最后一个TextViews是第二个xml文件的末尾。
第一个带有viewPager的xml:
<LinearLayout 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/recipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="5.80" >
<LinearLayout
android:id="@+id/recipe_linearLayout_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@android:color/background_light"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_marginTop="5dp"
android:layout_weight="18"
android:orientation="vertical" >
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="@drawable/background_tabs" >
</com.astuetz.PagerSlidingTabStrip>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
</android.support.v4.view.ViewPager>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
带有TextViews的第二个xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="5.80" >
<LinearLayout
android:id="@+id/recipe_linearLayout_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@android:color/background_light"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@color/red"
android:gravity="center"
android:text="INGREDIENTS"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<LinearLayout
android:id="@+id/ingLinearLayout"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/white"
android:orientation="vertical" >
<TextView
android:id="@+id/ingTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.11"
android:maxLines="20"
android:singleLine="false"
android:text="@string/verylongtext"
android:textColor="@color/black" />
</LinearLayout>
<TextView
android:id="@+id/TextView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/ingLinearLayout"
android:background="@color/red"
android:gravity="center"
android:text="DESCRIPTION"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<LinearLayout
android:id="@+id/descLinearLayout"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_below="@+id/TextView01"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/white"
android:orientation="vertical" >
<TextView
android:id="@+id/descTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.11"
android:maxLines="20"
android:singleLine="false"
android:text="@string/verylongtext"
android:textColor="@color/black" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
这是我滚动到底部时的样子:
这就是它的外观:
我无法找出它为什么会削减视图,为什么在向整个第二个xml文件显示之前无法向下滚动?
我正在使用此ViewPager库:github.com/astuetz/ViewPagerExtensions