ViewPager的活动不会垂直滚动

时间:2016-06-17 12:25:25

标签: android android-viewpager scrollview android-tabs

我有一个带有工具栏的活动和工具栏下方的图像,下面有几个TextView。我在下面实现了Tabs。 Tabs的水平滚动效果很好。当Tab中的内容更多时,垂直ScrollView在VieewPager部分内工作正常。但是当标签的内容更多时,我想垂直使整个页面Scoll。我试图自定义ScrollView类。我不想折叠工具栏中的内容。我想要滚动整个页面。但没有任何效果。请帮帮我们!!提前致谢。enter image description here

这是我的XML代码 -

if let cell_note = self.tbl.cellForRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 4)) as? NotesCell
{
    // do something with your data source
    // do something with cell_note that already loaded on screen
}
else
{
    // do something with your data source
    // your cell didn't loaded yet
    // you should only prepare fresh information in your data source for delegate method tableView(_:cellForRowAtIndexPath:) 
}

1 个答案:

答案 0 :(得分:1)

使用NestedScrollView尝试app:layout_behavior(并确保应用<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:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay"/> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content> <!-- The rest of your layout content here --> </LinearLayout> </android.support.v4.widget.NestedScrollView> </android.support.design.widget.CoordinatorLayout> ):

include $(CLEAR_VARS)
LOCAL_MODULE    := libpng
LOCAL_SRC_FILES += \
    ../jniLibs/$(TARGET_ARCH_ABI)/libpng.a
LOCAL_EXPORT_C_INCLUDES += \
    libpng
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libjpeg
LOCAL_SRC_FILES += \
    ../jniLibs/$(TARGET_ARCH_ABI)/libjpeg.a
LOCAL_EXPORT_C_INCLUDES += \
    libjpeg
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libcrypto
LOCAL_SRC_FILES += \
    ../jniLibs/$(TARGET_ARCH_ABI)/libcrypto.a

include $(PREBUILT_STATIC_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE    := processing
LOCAL_SRC_FILES += filter_jni.c \
        control.c

LOCAL_CFLAGS := -g -O3 -ffast-math
LOCAL_LDLIBS := -llog -lm -lz
LOCAL_STATIC_LIBRARIES += libpng  libjpeg libcrypto

include $(BUILD_SHARED_LIBRARY)