ViewPager à l'intérieur ScrollView - défilement vertical ne fonctionne pas

Donc, j'ai cette ScrollView avec un enfant - un LinearLayout qui a deux enfants: un TextView et un ViewPager. ViewPager contient de mise en page avec de nombreux éléments, c'est pourquoi j'ai besoin de la capacité à faire défiler l'écran verticalement. Pages dans ViewPager peut faire défiler horizontalement (c'est: j'aimerais faites glisser votre doigt horizontalement uniquement à l'intérieur de la ViewPager). Que l'on TextView ne doit pas faire défiler horizontalement mais doit défiler avec mon ViewPager.

Simple? No.

J'ai vu très des questions similaires à StackOverflow popping up (iciici et ici et ici).
Aucune des solutions proposées fonctionnent pour moi 🙁

Ce que je vois, c'est cette <- ma douce UI :), Cependant je ne peux pas faire défiler verticalement 🙁

Intégration ScrollViews à l'intérieur de ViewPager n'est pas une option - conception de l'INTERFACE utilisateur interdit cette.

C'est peut-être quelque chose avec mon par programme de remplissage de chaque page dans la vue pager? Hmmm...

Toutes les suggestions seraient appréciées.

Mon code:

activity_main.xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"

                android:id="@+id/scrollView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@android:color/white"
                android:fillViewport="true" >

                <LinearLayout
                    android:id="@+id/linearLayoutGeneral"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                    android:id="@+id/tvText"
                    android:layout_width="fill_parent"
                    android:layout_height="200dp"
                    android:text="Test text" />

                <android.support.v4.view.ViewPager
                            android:id="@+android:id/viewpager"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent" >
                </android.support.v4.view.ViewPager>


                </LinearLayout>
</ScrollView>

chaque page dans ViewPager a cette mise en page:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/layoutData"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>

unique de l'élément de mise en page à telle page:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="40dp"
    android:gravity="center"
    android:orientation="vertical"
    android:background="@android:color/white" >

    <TextView
        android:id="@+id/textView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Large Text"
        android:background="@android:color/black"
        android:textColor="@android:color/white"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

Un seul Fragment de page est très simple également:

public class DayFragment extends Fragment {
private static final String TAG = DayFragment.class.getSimpleName();
public String tag;
LinearLayout data;
View mView;
final int ROWS_NUM = 60;
public DayFragment() {
}
/**
* (non-Javadoc)
* 
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
*      android.view.ViewGroup, android.os.Bundle)
*/
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null) {
//We have different layouts, and in one of them this
//fragment's containing frame doesn't exist. The fragment
//may still be created from its saved state, but there is
//no reason to try to create its view hierarchy because it
//won't be displayed. Note this is not needed -- we could
//just run the code below, where we would create and return
//the view hierarchy; it would just never be used.
return null;
}
mView = (LinearLayout) inflater.inflate(R.layout.day, container, false);
setUpControls();
generateData();
String text = getArguments().getString("text");
Log.d(TAG, "creating view with text: " + text);
return mView;
}
private void setUpControls() {
data = (LinearLayout) mView.findViewById(R.id.layoutData);
}
private void generateData() {
for (int i = 0; i < ROWS_NUM; i++) {
View v = createRow(i);
data.addView(v);
}
}
private View createRow(int num) {
LayoutInflater inflater = (LayoutInflater) getActivity()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.row, null);
TextView tv = (TextView) v.findViewById(R.id.textView);
tv.setText("Data nr: " + num);
return v;
}
public static DayFragment newInstance(String text) {
Log.d(TAG, "newInstance with text: " + text);
DayFragment f = new DayFragment();
f.tag = text;
//Supply text input as an argument.
Bundle args = new Bundle();
args.putString("text", text);
f.setArguments(args);
return f;
}
}

source d'informationauteur Genkaku