【问题标题】:swipe effect like in samsung phone calling and message [duplicate]像三星电话和消息一样的滑动效果[重复]
【发布时间】:2013-06-07 20:10:01
【问题描述】:

我需要像在三星 android 设备中那样在列表视图中实现滑动,在通话记录中,当我们从左到右滑动时,呼叫被放置并且从右到左然后被放置消息

是否可以使用 swipeListView SwipeListViewDemo 或给我其他解决方案

【问题讨论】:

  • @IceMAN:这个问题的答案是关于滑动手势不适用于 listview,我需要为 listview 这样做,所以这个问题与那个问题不重复,我请求你重新打开它....
  • 这里有几个(实际上是三个)。 1:问题尚未结束。我已经投票关闭它。 2: 我不小心发布了错误的链接以标记为重复。这是关于SO的另一个问题。 3: 这是否可能使用 swipeListView SwipeListViewDemo 或给我其他解决方案 几乎已经回答了你的问题。使这个问题几乎没有意义......

标签: android swipe


【解决方案1】:

看看这个 git repo.. 这很可能是你正在寻找的东西.. 47Deg

【讨论】:

    【解决方案2】:

    是的,您可以使用甩动手势
    一些代码可以帮助你

     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);
    }
    };
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多