viewPager中的Android列表边缘效果

时间:2016-02-17 19:21:23

标签: android android-layout listview

我有viewPager有两个列表。我想要实现的是当我滚动列表以显示边缘效果时: enter image description here

只有当我滚动列表项目时才会发生这种情况,如果我的手指在空白处并且我尝试向上或向下滑动没有任何反应。有什么建议?我的代码:
activity_main.xml中          

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/scanButton"
        style="@style/floatingActionButton"
        android:layout_width="56dp"
        android:layout_height="56dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_margin="16dp"
        android:scaleType="center"
        android:src="@drawable/add_fuego"
        android:tint="@android:color/white"
        app:borderWidth="0dp"
        app:elevation="6dp"
        app:pressedTranslationZ="12dp" />

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- Toolbar instead of ActionBar so the drawer can slide on top -->
        <include layout="@layout/main_toolbar" />

        <de.sourcestream.fuego.fuego.view.SlidingTabLayout
            android:id="@+id/sliding_tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary" />
        <!-- Real content goes here -->
        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/pager"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <View
                android:layout_width="match_parent"
                android:layout_height="5dp"
                android:background="@drawable/toolbar_dropshadow" />
        </FrameLayout>
    </LinearLayout>
</RelativeLayout>

scan_user_list.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white">

    <ListView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        android:clipToPadding="false"
        android:divider="@color/scansDivider"
        android:dividerHeight="1dp"
        android:overScrollMode="always"
        android:listSelector="@drawable/listitem_selector"
        android:paddingTop="3dp"
        tools:listitem="@layout/scan_user_row" />

</RelativeLayout>

0 个答案:

没有答案