J'ai un ViewPager qui réside à l'intérieur d'une disposition linéaire parente et sous le ViewPager il y a quelques boutons. Le ViewPager fonctionnait bien jusqu'à récemment, j'ai changé le parent de LinearLayout à un ScrollView. Maintenant, le ViewPager a disparu. Merci de ne pas le marquer comme spam ou duplicata.Impossible de placer ViewPager à l'intérieur d'un ScrollVIew/NestedScrollView
De plus, il y a des tonnes d'applications sur Playstore utilisant actuellement ceci. Voir cette application - link
Ce que j'essayées:
- setFillViewport (true) - Cela ne fonctionne pas pour moi.
- Set layout_height à 0DP
- Utilisez un CustomScrollView
Tout cela ne me permet pas. Je courais l'application sur Android M.
Ceci est mon layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
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:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".activities.HomeActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:onClick="pagerClick"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="top"
android:layout_weight="1"
android:overScrollMode="never"/>
<RelativeLayout
android:layout_weight="0.8"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
.....two buttons
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Question:
Comment puis-je y parvenir? Aussi, existe-t-il une façon officielle de le faire?
Mettez ur scrollview imbriquées à l'intérieur une mise en page parent ex: coordinatorLayout – MrCurious
Cela n'aide pas non plus – Rohn
post full xml .. – phpdroid