【问题标题】:Android listview in scrollview, listview scroll when scrollview scrolled specific positionandroid listview in scrollview,当scrollview滚动特定位置时listview滚动
【发布时间】:2015-07-29 11:39:34
【问题描述】:

我需要在 Scrollview 中使用 Scroll Listview。

Scrollview 有两个子视图,Relative layout 和 Listview

而列表视图正在使用naver's PullToRefresh library

我想要两个功能

  • 向上滚动时,滚动大约一半的相对布局,通过触摸事件传递给列表视图。
  • 向下滚动时,如果列表视图显示第一项,则真实布局将完全显示。否则相对布局必须是固定滚动列表视图。如果用户过度滚动,则必须使用下拉刷新。

我有示例截图

https://www.dropbox.com/s/8renmrmw5n8g5em/example.png?dl=0

它实际上在项目中使用,受 NDA 保护。我审查了它。

我曾尝试 requestDisallowInterceptTouchEvent(),它不适合我。

我的布局 xml。

<ScrollView
    android:id="@+id/main_doc_scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    android:fillViewport="true">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <include
            layout="@layout/main_page_top_scroll_items"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"/>
        <com.handmark.pulltorefresh.library.PullToRefreshListView
            xmlns:ptr="http://schemas.android.com/apk/res-auto"
            android:id="@+id/main_doc_list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#00000000"
            android:divider="#00FF0000"
            android:dividerHeight="0dp"
            android:fadingEdge="none"
            android:fastScrollEnabled="false"
            android:footerDividersEnabled="false"
            android:headerDividersEnabled="false"
            android:smoothScrollbar="true"
            android:scrollbars="none"
            ptr:ptrFriction="3.0"
            ptr:ptrSmoothScrollDuration="400" />
    </LinearLayout>
</ScrollView>

感谢您的友好合作。

【问题讨论】:

标签: android layout android-listview scrollview


【解决方案1】:

解决了。

我放弃使用滚动视图。

我在 Listview 上使用 onScrollListener,实时更改菜单的 marginTop。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-05
    • 1970-01-01
    • 1970-01-01
    • 2013-10-01
    • 2011-09-06
    • 2013-09-19
    • 2016-06-23
    • 1970-01-01
    相关资源
    最近更新 更多