ViewPager не отображается в scrollview
Здравствуйте.
Имею группу view, которые образуют собой фрагмент. В данной группе есть viewPager. FrameLayout, в который это фрагмент выводится, лежит в scrollview. Возникла проблема: почему-то именно viewPager в скролле не отображается. Все элементы группы есть, а его нет. В чем может быть причина?
Активити:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:background="@color/blue_light" android:id="@+id/linearLayout"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvNameTest" android:layout_alignParentTop="true" style="@style/child_text_form"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/linearLayout"
android:scrollbars="none"
android:animationCache="false"
android:orientation="vertical"
android:fadingEdge="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:background="@color/blue_light"
android:gravity="center_vertical|center_horizontal" android:id="@+id/relativeLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/containerQuestion">
<ImageView android:layout_width="0dp" android:layout_height="wrap_content"
android:id="@+id/ivLastQuestion" android:layout_alignParentLeft="false"
android:layout_gravity="center_vertical" android:layout_weight="0.1" android:padding="8dp"
android:src="@android:drawable/ic_media_previous"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/tvTextQuestion" style="@style/main_text_form" android:layout_weight="0.8"
android:gravity="center_vertical|center_horizontal"/>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/ivNextQuestion" android:layout_alignParentLeft="false"
android:layout_gravity="center_vertical" android:layout_weight="0.1" android:padding="8dp"
android:src="@android:drawable/ic_media_next"/>
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/frameFragment">
</FrameLayout>
</LinearLayout>
</ScrollView>
<ImageView
android:layout_width="match_parent"
android:layout_height="4dp"
android:id="@+id/imageView" android:layout_below="@+id/linearLayout" android:src="@drawable/shadow"/>
</RelativeLayout>
Фрагмент:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@android:color/white">
<android.support.v4.view.ViewPager
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/vPager"/>
<LinearLayout
android:id="@+id/lMark"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
Источник: Stack Overflow на русском