Horizontal Shooting ListView ListView

I have a list displaying entries for a given date. Above the list there are buttons that allow you to increase / decrease the date. Everything is working. What I want to do is replace these buttons and scroll the image left / right to increase / decrease the date.

What is the best way to do this? I don’t care that the item has been removed, often there will be no items in the list on a given date, as long as this happens in the list area. I already have clicks and long listeners.

+5
source share
1 answer

Just implement OnGestureListener.

public class MyListActivity extends ListActivity implements OnGestureListener

Use GestureDetector

GestureDetector detector = new GestureDetector(this, this);

Pass List Touch event to GestureDetector

listView.setOnTouchListener(new OnTouchListener() {
    public boolean onTouch(View view, MotionEvent e) {
        detector.onTouchEvent(e);
        return false;
    }
});

, , fling . .

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {}
+13

All Articles