fix: 修改拖动时子View被缩放的问题
This commit is contained in:
parent
27c918f1be
commit
7df4ce2ce4
@ -510,12 +510,41 @@ public class SplitLayout extends ViewGroup {
|
||||
// 获取高斯模糊的bitmap图片
|
||||
private Bitmap getBlurBitmap() {
|
||||
// 先获取当前界面的整体截图
|
||||
getBitmapFromChildView(); // 先获取两个子View的截图
|
||||
// 将截图绘制到cachedCanvas上
|
||||
cachedCanvas.drawColor(getContext().getColor(android.R.color.transparent), PorterDuff.Mode.CLEAR);
|
||||
if (cachedBitmapArray != null) {
|
||||
Rect child0Rect = new Rect();
|
||||
Rect child1Rect = new Rect();
|
||||
if (mOrientation == VERTICAL) {
|
||||
child0Rect.set(0, 0, getWidth(), (int) (mSplitPosition - mHandleSize / 2));
|
||||
child1Rect.set(0, (int) (mSplitPosition + mHandleSize / 2), getWidth(), getHeight());
|
||||
} else {
|
||||
child0Rect.set(0, 0, (int) (mSplitPosition - mHandleSize / 2), getHeight());
|
||||
child1Rect.set((int) (mSplitPosition + mHandleSize / 2), 0, getWidth(), getHeight());
|
||||
}
|
||||
cachedCanvas.drawBitmap(cachedBitmapArray[0], null, child0Rect, null);
|
||||
// cachedCanvas.drawBitmap(((BitmapDrawable)getContext().getDrawable(R.drawable.icon_app)).getBitmap(),
|
||||
// child0Rect.centerX() - (getContext().getDrawable(R.drawable.icon_app).getBounds().width()/2),
|
||||
// child0Rect.centerY() - (getContext().getDrawable(R.drawable.icon_app).getBounds().height()/2), null);
|
||||
cachedCanvas.drawBitmap(cachedBitmapArray[1], null, child1Rect, null);
|
||||
// cachedCanvas.drawRect(child1Rect, mPaint);
|
||||
// cachedCanvas.drawBitmap(((BitmapDrawable)getContext().getDrawable(R.drawable.icon_app)).getBitmap(),
|
||||
// child1Rect.centerX() - (getContext().getDrawable(R.drawable.icon_app).getBounds().width()/2),
|
||||
// child1Rect.centerY() - (getContext().getDrawable(R.drawable.icon_app).getBounds().height()/2), null);
|
||||
Bitmap blurBitmap = UtilBitmap.blurBitmap(getContext(), cachedBitmap, 20f);
|
||||
cachedCanvas.drawColor(getContext().getColor(android.R.color.transparent), PorterDuff.Mode.CLEAR);
|
||||
cachedCanvas.drawBitmap(blurBitmap, 0, 0, null);
|
||||
return blurBitmap;
|
||||
} else {
|
||||
Bitmap currentBitmap = loadBitmapFromViewBySystem(this);
|
||||
return UtilBitmap.blurBitmap(getContext(), currentBitmap, 20f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 此方法直接截取屏幕指定view区域的内容
|
||||
*
|
||||
* @param view 需要截取屏幕的图片view
|
||||
* @return Bitmap
|
||||
*/
|
||||
@ -589,7 +618,7 @@ public class SplitLayout extends ViewGroup {
|
||||
|
||||
/**
|
||||
* 设置子View的最小宽度
|
||||
* */
|
||||
*/
|
||||
public int getmChildMinSize() {
|
||||
return mChildMinSize;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user