我使用https://github.com/nhaarman/ListViewAnimations来实现拖放、滑动删除等功能。但是存在问题,第一张图片可以滚动列表,但无法拖放(它会掉到相同的位置,并且不进入onItemMoved)。
第二张图片中我移除了LinearLayout。现在我可以滚动和拖放,但布局已经破碎。
我认为我将测量整个屏幕高度,然后直接固定NestedScrollView的高度。但我认为这可能不是解决问题的最佳方法。我的问题是是否有更好的方法来解决我的问题?
第三张图片中我移除了LinearLayout和NestedScrollView,因此用户无法滚动列表。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:background="@color/green_400"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="180dp"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="@color/transparent"
app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<!--app:layout_scrollFlags="scroll|exitUntilCollapsed"|-->
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/header"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:background="@android:color/transparent"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="@color/red_600"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
android:id="@+id/listViewTaskInComplete"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<include layout="@layout/floating_action_btn"/>
</android.support.design.widget.CoordinatorLayout>