滚动视图中的Android列表视图,滚动视图滚动特定位置时列表视图滚动

时间:2015-05-18 04:39:08

标签: android layout android-listview scrollview

我需要Scrollview中的Scroll Listview。

Scrollview有两个子视图,相对布局和Listview

listview正在使用naver's PullToRefresh library

我想要两个功能

  • 向上滚动时,滚动约一半相对布局,将触摸事件传递给列表视图。
  • 向下滚动时,如果listview显示第一个项目,则realative布局将完全显示。否则相对布局必须固定只滚动listview。如果用户已经过度滚动,则必须执行pull-to-refresh。

我有示例截图

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>

感谢您的友好合作。

1 个答案:

答案 0 :(得分:0)

解决。

我放弃使用滚动视图。

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

相关问题