我需要在列表视图中实现滑动,就像在三星安卓设备中一样,在通话日志中,当我们从左向右滑动时,正在放置呼叫,从右到左然后正在放置消息
这可以使用swipeListView SwipeListViewDemo或者给我其他解决方案
答案 0 :(得分:0)
看看这个git repo ..这可能是你正在寻找的.. 47Deg
答案 1 :(得分:-1)
是的,你可以使用fling手势来做 一些代码可以帮助您
SimpleOnGestureListener mySimpleGestureListener = new SimpleOnGestureListener()
{
@Override
public boolean onDoubleTap(MotionEvent e) {
Logout.debug("onDoubleTap");
return super.onDoubleTap(e);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY)
{
String velocity="onFling: \n" + e1.toString() + "\n" + e2.toString() +"\n"
+ "velocityX= " + String.valueOf(velocityX) + "\n"
+ "velocityY= " + String.valueOf(velocityY) + "\n";
Logout.debug("onFling velocity="+velocity);
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public void onLongPress(MotionEvent e) {
Logout.debug("onLongPress: \n" + e.toString());
super.onLongPress(e);
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Logout.debug("onSingleTapConfirmed: \n" + e.toString());
return super.onSingleTapConfirmed(e);
}
private boolean permissibleYVelocity(float velocityY)
{
if ((velocityY < -200) || (velocityY > 200))
{
return false;
}
else
{
return true;
}
}
};
GestureDetector myGestureDetector = new GestureDetector(mSimpleOnGestureListener);
View.OnTouchListener mOnListTouchListener = new OnTouchListener()
{
@Override
public boolean onTouch(View view, MotionEvent event)
{
Logout.debug("list onTouch()");
return myGestureDetector.onTouchEvent(event);
}
};