2016-11-03 4 views
0

Ich verwende eine Scroll-Ansicht in einem Fragment, das in einem View-Pager verwendet wird. Aber die Schriftrolle scheint nicht zu funktionieren.Scrollview funktioniert nicht im View-Pager-Fragment

<ScrollView 
     android:id="@+id/scrollview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 
    <android.support.percent.PercentRelativeLayout 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     > 
... 
... 
... 
</android.support.percent.PercentRelativeLayout> 
</ScrollView> 

Dies ist das Layout des Fragments. Scrollen scheint aber überhaupt nicht zu funktionieren.

Antwort

0

versuchen diese

scrollview.setOnTouchListener(new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View v, MotionEvent event) { 
      v.getParent().requestDisallowInterceptTouchEvent(true); 
      return false; 
     } 
    }); 
0

Sie können versuchen, die "wrap_parent" in der "Scrollview" und seine untergeordneten Ansichten zu verwenden:

android: layout_height = "wrap_parent"

0

Make Ansicht blättern oben (dh übergeordnet) mit Füllhöhe und -breite.

0

Verwendung NestedScrollView wie unten:

<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:id="@+id/scroll" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context=".FragmentContactInfo"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 
    </LinearLayout> 
</android.support.v4.widget.NestedScrollView> 
Verwandte Themen