2016-02-17 87 views
2

我在一个活动中使用三个片段与tablayout。在片段中,我有12个edittext,所以我把它们放到scrollview中。但是滚动不起作用,我只能看到几个edittext。滚动查看内部片段不会滚动

fragment.xml之

<ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:padding="1dp" 
     android:background="#fffbfbfb" 
     android:fillViewport="false" 
     android:id="@+id/scrollView"> 

     <TableLayout 

      android:id="@+id/tableLayout1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:stretchColumns="0" 
      android:background="#fffbfbfb"> 
    ........ 
</scrollview> 

activity.xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabGravity="fill" 
      app:tabMode="fixed" /> 


     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

    </android.support.design.widget.AppBarLayout> 

</android.support.design.widget.CoordinatorLayout> 
+0

HI,复制fragment.xml中的所有视图。 –

+0

分享你的fragment.xml完整代码 –

+0

在你说的问题你说标签布局和代码中使用的表格布局? –

回答

0

好吧,我做了一件事fragment.java文件:

现在滚动型工作正常,但viewpager已停止工作我的意思是我不能通过水平触摸来改变片段,因为它在将上述方法放入fragment.java之前正在工作。

2

如果使用滚动视图协调布局里面,而不是使用默认的滚动视图,请尝试使用NestedScrollView

0

尝试这您的代码并确保滚动视图有单个孩子

<ScrollView 
android:layout_height="fill_parent" 
android:layout_width="wrap_content" 
android:fillViewport="true" 
android:isScrollContainer="false" 

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

如果还是不行,然后在包装线性表的布局布局