Question

I'm using the 47degrees android swipe list view https://github.com/47deg/android-swipelistview

I have all the files copied into my Eclipse project unchanged.

I have the listview setup in xml

<com.company.appname.swipe.SwipeListView
            xmlns:swipe="http://schemas.android.com/apk/res-auto"
            android:id="@+id/home_list_view"
            android:listSelector="#00000000"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            swipe:swipeFrontView="@id/swipelist_frontview"
            swipe:swipeBackView="@id/swipelist_backview"
            swipe:swipeActionLeft="reveal"
            swipe:swipeActionRight="reveal"
            swipe:swipeMode="both"
            swipe:swipeCloseAllItemsWhenMoveList="false"
            swipe:swipeOpenOnLongPress="false"
            swipe:swipeAnimationTime="300"
            swipe:swipeOffsetLeft="100dp"
            swipe:swipeOffsetRight="0dp"
            />

I have setup the SwipeListView in code

SwipeListViewTouchListener touchListener = new SwipeListViewTouchListener(mListView, R.id.swipelist_frontview, R.id.swipelist_backview);
    touchListener.resetItems();
    mListView.setOnTouchListener(touchListener);

When I try to swipe an list item, the top view begins sliding away for a second then stops part way (say 10% on average but may vary slightly depending on the speed of the swipe). So it is stuck there in that position. The second time I try to swipe it, it scrolls smoothly away.

Note: It pauses every second time I touch an item - but it doesn't have to be the same item. For example, I could begin to swipe one row which will stop, then I could scroll either the same row or a different one and it will be smooth.

On investigation, I noticed the first attempt at swiping throws and MotionEvent.ACTION_DOWN event followed by a MotionEvent.ACTION_UP event. The second time there is a MotionEvent.ACTION_DOWN followed by a MotionEvent.ACTION_MOVE followed by a MotionEvent.ACTION_UP (So the first time there is no MotionEvent.ACTION_MOVE)

Any ideas or suggestions?

Was it helpful?

Solution 2

It seems that changing the listview swipemode property to

swipe:swipeMode="none"

fixes my particular problem.

OTHER TIPS

I have used swipe listview in my project and I am not facing any problems. The only difference I see in your code and mine is touchListener.resetItems(); I used swipe listener not touchlistener.

listViewCalendar
            .setSwipeListViewListener(new BaseSwipeListViewListener() {

                @Override
                public void onOpened(int position, boolean toRight) {
                }

                @Override
                public void onClosed(int position, boolean fromRight) {
                }

                @Override
                public void onListChanged() {
                }

                @Override
                public void onMove(int position, float x) {
                }

                @Override
                public void onStartOpen(int position, int action,
                        boolean right) {

                }

                @Override
                public void onStartClose(int position, boolean right) {



                }

                @Override
                public void onClickFrontView(int position) {
                    // 
                }

                @Override
                public void onClickBackView(int position) {
                    // Log.d("swipe", 
                }

                @Override
                public void onDismiss(int[] reverseSortedPositions) {

                }

            });

    listViewCalendar.setOffsetLeft((width - convertDpToPixel(115)));
    listViewCalendar.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT);
    listViewCalendar.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL);
    listViewCalendar.setOffsetLeft(width - convertDpToPixel(120f));
    listViewCalendar.setAnimationTime(75);

and heres my xml.

<com.fortysevendeg.swipelistview.SwipeListView
    xmlns:swipe="http://schemas.android.com/apk/res-auto"
    android:id="@+id/listViewCalendar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/buttonNewEntry"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/relativeLayout1"
    android:listSelector="#00000000"
    swipe:swipeBackView="@+id/back"
    swipe:swipeCloseAllItemsWhenMoveList="true"
    swipe:swipeFrontView="@+id/front"
    swipe:swipeMode="both" >
</com.fortysevendeg.swipelistview.SwipeListView>

Feel free to ask any questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top