我想在滑动面板中重新创建Material Design 列表: Android中的控件.
我正在利用:
我最终使用了部分支持库,但这个特定的应用程序只有5.0+,所以我的代码中可能只有一些Lollipop.
这是我的RecyclerView中列表项的布局:
<com.daimajia.swipe.SwipeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right">
<RelativeLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:focusable="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_delete_black_24dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_floating"
android:clickable="true"
android:focusable="true"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:elevation="2dp">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:text="..."/>
</RelativeLayout>
</com.daimajia.swipe.SwipeLayout>
Run Code Online (Sandbox Code Playgroud)
这是目前的结果.
要解决的其余问题是高程阴影和分隔线.
正如您在图像中看到的那样,列表项的两侧有一些合理的阴影.但是项目底部没有高度阴影,因此当显示项目时,在显示区域上方没有阴影.
第二个问题是分隔线.我有一个没有图标/图像的单项列表,所以正确的设计是使用项目的分隔符.
但是我不能使用serso/android-linear-layout-manager中的DividerItemDecoration,因为它没有集成到滑块中,当滑动了2个相邻的项目时会发生这种情况.

有没有人知道我应该使用任何drawable,属性或库来将这些列表项设置为具有高程阴影和边框的材料表?