zoukankan      html  css  js  c++  java
  • launcher跨屏拖动item(GridView长按item进行拖动demo)

    触发长按事件后浮动原理:

      windowParams = new WindowManager.LayoutParams();

      windowParams.gravity = Gravity.TOP | Gravity.LEFT;

      windowParams.x = x - itemWidth / 2;

      windowParams.y = y - itemHeight / 2;

      windowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;

      windowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;

      ImageView iv = new ImageView(getContext());

      iv.setImageBitmap(bm);

      windowManager = (WindowManager) getContext().getSystemService(

      Context.WINDOW_SERVICE);// "window"

      windowManager.addView(iv, windowParams);

      拖动效果:

      if (dragImageView != null) {

      windowParams.alpha = 0.6f;

      windowParams.x = x - itemWidth / 2;

      windowParams.y = y - itemHeight / 2;

      windowManager.updateViewLayout(dragImageView, windowParams);

      }

  • 相关阅读:
    二分查找改遍
    条件运算符?:
    k倍区间
    分巧克力
    mm
    素数
    递归return
    确定一个域名使用的邮箱服务商
    mysql 存储过程一实例
    使用vmware 共享 windows下的文件夹 到 centos
  • 原文地址:https://www.cnblogs.com/shanzei/p/2419373.html
Copyright © 2011-2022 走看看