padding属性为什么会影响RecyclerView拖动

时间:2017-08-03 09:55:34

标签: android android-recyclerview

我使用ItemTouchHelper来实现拖动操作RecyclerView,并设置android:clipChildren="false"以使其可以拖出RecyclerView's rect范围。布局文件如下:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#999999"
android:clipChildren="false"
tools:ignore="RtlHardcoded">

<android.support.design.widget.AppBarLayout
    android:id="@+id/main_appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@null"
    app:layout_behavior="android.support.design.widget.AppBarLayoutSpringBehavior">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/main_collapsing"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <TextView
            android:id="@+id/delete"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="#99999999"
            android:gravity="center"
            android:text="delete"
            android:textColor="@android:color/white"
            android:textSize="25sp"
            android:visibility="invisible" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/main_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:contentInsetStart="0dp"
            app:layout_collapseMode="pin"
            app:title="">

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="@dimen/left_bar_width"
    android:layoutAnimation="@anim/anim_layout"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

到现在为止一直很好:

enter image description here

问题是 ,当我向RecyclerView添加padding(例如android:paddingTop =“10dp”)时,它无法拖出RecyclerView范围: enter image description here

如何解决?

1 个答案:

答案 0 :(得分:0)

<script> $('.price_range').jRange({ from: 0, to: 67390000, step: 50, format: '%s USD', width: 300, showLabels: true, isRange : true }); </script> 应解决问题