Hi i am new to android i was trying to make the swipe to dismiss feature with cardview
& Recyclerview
using itemtouchhelper.callback
so i need to pass cardview
as the only item in RecyclerView
as this answer mentioned but i don't know how to extend the cardView
to make customview?
cardStack
import android.content.Context;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
public class CardStack extends CardView {
private int image;
public CardStack(Context context) {
super(context);
initialize(context);
}
public CardStack(Context context, AttributeSet attrs) {
super(context, attrs);
initialize(context);
}
public CardStack(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void initialize(Context context){
LayoutInflater.from(context).inflate(R.layout.card,this);
//What to do here?
}
card.xml
<?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"
android:orientation="vertical">
<com.stocks.android.cardviewobjectswipefeaturestocks.CardStack
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/card1" />
</com.stocks.android.cardviewobjectswipefeaturestocks.CardStack>
</LinearLayout>