简体   繁体   English

Android listview在scrollview中,listview在scrollview滚动到特定位置时滚动

[英]Android listview in scrollview, listview scroll when scrollview scrolled specific position

I need Scroll Listview inside Scrollview. 我需要Scrollview中的Scroll Listview。

Scrollview has two child view, Relative layout and Listview Scrollview有两个子视图,相对布局和Listview

And listview is using naver's PullToRefresh library . listview使用naver的PullToRefresh库

I want two function 我要两个功能

  • When scroll-up, scroll about half of Relative layout, pass thru touch event to listview. 向上滚动时,滚动到相对布局的一半,然后将触摸事件传递给listview。
  • When scroll-down, if listview showing first item, realative layout will showing fully. 向下滚动时,如果列表视图显示第一项,则实际布局将完整显示。 else relative layout must be fixed scroll only listview. 否则相对布局必须固定,仅滚动listview。 And if user had over scroll, pull-to-refresh must be work. 而且,如果用户进行了过度滚动,则必须进行“按一下刷新”操作。

I have example screenshot 我有示例屏幕截图

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

It actually using in project, protected by NDA. 它实际上在受NDA保护的项目中使用。 that I censored it. 我审查了它。

I had try to requestDisallowInterceptTouchEvent(), it not for me. 我曾尝试requestDisallowInterceptTouchEvent(),但对我来说不行。

My layout xml. 我的布局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>

Thank you for your kind cooperation. 感谢您的友好合作。

solved. 解决了。

I give up to use scroll view. 我放弃使用滚动视图。

I using onScrollListener on Listview, change menu's marginTop realtime. 我在Listview上使用onScrollListener,实时更改菜单的marginTop。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM