2015-05-18 192 views
0

我需要在滾動視圖內滾動列表視圖。在滾動視圖中的列表視圖,列表視圖在滾動視圖滾動特定位置時滾動

滾動視圖有兩個子視圖,相對佈局和ListView

和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> 

謝謝您的友好合作。

+0

檢查了這一點 - http://stackoverflow.com/a/30259834/1479511 – NarendraJi

+0

@DroidWormNarendra謝謝你的建議,但我試過,我什麼都得不到...... –

回答

0

解決了。

我放棄使用滾動視圖。

我在列表視圖上使用onScrollListener,更改菜單的marginTop實時。