android - fragment 内的 ScrollView 根本不滚动

标签 android scrollview

我在一个带有 tablayout 的 Activity 中使用了三个 fragment 。在 fragment 中,我有 12 个编辑文本,因此我将它们放入 ScrollView 中。但是滚动不起作用,我只能看到很少的编辑文本。

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>

最佳答案

如果您在协调器布局中使用 ScrollView ,请尝试使用 NestedScrollView 而不是使用默认 ScrollView 。

关于android - fragment 内的 ScrollView 根本不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35448145/

相关文章:

android - 下载的位图图像显示太小

android - Adobe Flash Builder Flex 移动 Android : Avoid that user can close the app

java - 获取有效的 JNIEnv 指针

android - 找出智能手机支持的使用权限

javascript - getBoundingClientRect() 内 »溢出 :scroll«

ios - 使 GridLayout 中的 NativeScript ScrollView 和 TextView 一起工作(仅限 iOS)

android - 使用 c++11 std::async 在 android ndk 中无效使用不完整类型

java - 如何在android中将scrollview添加到keyboardView

android - 如何在android中创建多个 ListView

android - Scrollview 水平和垂直不能同时工作