how to implement fling in android listview

久未见 提交于 2019-11-26 19:47:18

问题


I would like to implement onfling (or some similar swipe) in listview in each and every item in list. If I swipe that particular item it should display three buttons next to the name.

Is there any idea to implement this.


回答1:


I have implemented this with the help of gesture detection:

gestureDetector = new GestureDetector(context, new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        return gestureDetector.onTouchEvent(event);
    }
};
mList.setOnTouchListener(gestureListener);



回答2:


Use EfficientAdapter rather than listview. Using which you can set theonFling event and override it to your needs



来源:https://stackoverflow.com/questions/4030389/how-to-implement-fling-in-android-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!