8.1Launcher3 去掉桌面底部漸白色部分
vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/GradientView.java
private boolean mShowScrim = true;
protected void onDraw(Canvas canvas) {
Paint paint = mShowScrim ? mPaintWithScrim : mPaintNoScrim;
float head = 0.29f;
float linearProgress = head + (mProgress * (1f - head));
float startMaskY = (1f - linearProgress) * mHeight - mMaskHeight * linearProgress;
float interpolatedAlpha = (255 - mAlphaStart) * mAccelerator.getInterpolation(mProgress);
paint.setAlpha((int) (mAlphaStart + interpolatedAlpha));
float div = (float) Math.floor(startMaskY + mMaskHeight);
mAlphaMaskRect.set(0, startMaskY, mWidth, div);
mFinalMaskRect.set(0, div, mWidth, mHeight);
- canvas.drawBitmap(mAlphaGradientMask, null, mAlphaMaskRect, paint);
+ // canvas.drawBitmap(mAlphaGradientMask, null, mAlphaMaskRect, paint); //huacao
canvas.drawRect(mFinalMaskRect, paint);
問題:修改後底下出現其他顏色的部分!
原因:機器本來是800*1280的,結果dpi設定為160,導致了這個問題。
解決方法一: 改dpi 為213或者240
解決方法二 :把mMaskHeight 加點值 ,比如,mMaskHeight 改為 (mMaskHeight+30) 。
vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/GradientView.java
@Override
protected void onDraw(Canvas canvas) {
Paint paint = mShowScrim ? mPaintWithScrim : mPaintNoScrim;
Paint paint1 = mPaintNoScrim; //huacao
float head = 0.29f;
float linearProgress = head + (mProgress * (1f - head));
float startMaskY = (1f - linearProgress) * mHeight - (mMaskHeight+30) * linearProgress; //huacao
float interpolatedAlpha = (255 - mAlphaStart) * mAccelerator.getInterpolation(mProgress);
paint.setAlpha((int) (mAlphaStart + interpolatedAlpha));
float div = (float) Math.floor(startMaskY + (mMaskHeight+30));//huacao
mAlphaMaskRect.set(0, startMaskY, mWidth, div);
mFinalMaskRect.set(0, div, mWidth, mHeight);
//canvas.drawBitmap(mAlphaGradientMask, null, mAlphaMaskRect, paint);//huacao
canvas.drawRect(mFinalMaskRect, paint);
if (DEBUG) {
mDebugPaint.setColor(0xFF00FF00);
canvas.drawLine(0, startMaskY, mWidth, startMaskY, mDebugPaint);
canvas.drawLine(0, startMaskY + (mMaskHeight), mWidth, startMaskY + (mMaskHeight), mDebugPaint);
}
}