Closed awhlee closed 8 years ago
This was definitely some user error. After playing around (using the sample2 xml as reference), I got it working. Here is the "update" XML file that has something working.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
<com.daimajia.swipe.SwipeLayout
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:tag="Bottom2"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center"
android:background="#FF5534"
android:weightSum="10">
<ImageView
android:id="@+id/trash"
android:layout_width="27dp"
android:layout_height="30dp"
android:layout_weight="1"
android:src="@drawable/android_notification" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:text="Delete Item?"
android:textColor="#fff"
android:textSize="17sp" />
<Button
android:id="@+id/delete"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="4"
android:background="#ffffff"
android:text="Yes,Delete"
android:textColor="#FF5534" />
</LinearLayout>
<LinearLayout
android:tag="Bottom3"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center"
android:background="#0F5534"
android:weightSum="10">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:text="Delete Item?"
android:textColor="#fff"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" >
<TextView
android:id="@+id/position"
android:background="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/text_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="Hover"/>
</LinearLayout>
</com.daimajia.swipe.SwipeLayout>
Not too sure how I got it working (I'll have to dig deeper as soon as I post this) but there are 3 things that I played around with.
Thanks and sorry if I misled anyone earlier. --Tony
Hi,
If I use the "default" values (right edge drag is enabled) in my xml, everything works fine for the list items in my recyclerview. I can see the top layer as a default and dragging from right to left shows the underlying layer. Perfect. When I add a left drag edge, there is strange behavior. The top layer's text is no longer visible (just white) and it doesn't seem like a draft from left to right does anything. The draft from right to left still shows the underlying layer.
Here is my xml for the recycler view list item.
<?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
I enable the left drag edge in my adapter's onCreateViewHolder() for each ViewHolder:
Thanks --Tony