簡體   English   中英

Android listview在scrollview中,listview在scrollview滾動到特定位置時滾動

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

我需要Scrollview中的Scroll Listview。

Scrollview有兩個子視圖,相對布局和Listview

listview使用naver的PullToRefresh庫

我要兩個功能

  • 向上滾動時,滾動到相對布局的一半,然后將觸摸事件傳遞給listview。
  • 向下滾動時,如果列表視圖顯示第一項,則實際布局將完整顯示。 否則相對布局必須固定,僅滾動listview。 而且,如果用戶進行了過度滾動,則必須進行“按一下刷新”操作。

我有示例屏幕截圖

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>

感謝您的友好合作。

解決了。

我放棄使用滾動視圖。

我在Listview上使用onScrollListener,實時更改菜單的marginTop。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM