SlidingDrawer 偏移,仿QQ音乐

 @Override
 protected void dispatchDraw(Canvas canvas) {
long time = getDrawingTime();
  View handle = super.getHandle();
  View content = super.getContent();
  drawChild(canvas, handle, time);
  if (!this.isOpened()||this.isMoving()) {
   canvas.save();
   float f2 = (handle.getTop() - this.getTop()) / 2;
   canvas.clipRect(handle.getLeft(), handle.getBottom(), this
     .getRight(), this.getBottom());
   canvas.translate(0, f2);
  drawChild(canvas, content, time);
   canvas.restore();
  } else {
   super.dispatchDraw(canvas);
  }
 }
}

你可能感兴趣的:(SlidingDrawer 偏移,仿QQ音乐)