-2

I am not able to achieve proper UI for card stack.

Please check this picture this is requirement which I have to fulfill soon.

This is image for Card Stack UI please refer this

I had used https://github.com/aaronbond/Swipe-Deck too but UI is not as per requirement I tried to customize also but not success.

Your help will be highly appreciated Thank you.

Mohsin Khan
  • 139
  • 4
  • 13

1 Answers1

0

Use the below library which is working perfectly.

https://github.com/flschweiger/SwipeStack

XML file

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false">

    <link.fls.swipestack.SwipeStack
        android:id="@+id/swipeStack"
        android:layout_width="320dp"
        android:layout_height="240dp"
        android:padding="32dp"/>

</FrameLayout>

Adapter Code

public class SwipeStackAdapter extends BaseAdapter {

    private List<String> mData;

    public SwipeStackAdapter(List<String> data) {
        this.mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public String getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        convertView = getLayoutInflater().inflate(R.layout.card, parent, false);
        TextView textViewCard = (TextView) convertView.findViewById(R.id.textViewCard);
        textViewCard.setText(mData.get(position));

        return convertView;
    }
}
Maheshwar Ligade
  • 6,709
  • 4
  • 42
  • 59