简体   繁体   中英

Android listview in scrollview, listview scroll when scrollview scrolled specific position

I need Scroll Listview inside Scrollview.

Scrollview has two child view, Relative layout and Listview

And listview is using naver's PullToRefresh library .

I want two function

  • When scroll-up, scroll about half of Relative layout, pass thru touch event to listview.
  • When scroll-down, if listview showing first item, realative layout will showing fully. else relative layout must be fixed scroll only 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

It actually using in project, protected by NDA. that I censored it.

I had try to requestDisallowInterceptTouchEvent(), it not for me.

My layout 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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