如果你不想改为全透明,只想调节透明度
1.packages\apps\Launcher3\res\values\styles.xml
主题一:
<style name="BaseLauncherThemeWithCustomAttrs" parent="@style/BaseLauncherTheme">
<item name="allAppsScrimColor">#CCFFFFFF</item>
主题二:
<style name="LauncherThemeDark" parent="@style/LauncherTheme">
<item name="allAppsScrimColor">#7A212121</item>
其中#号后面的两位数字“CC”和“7A”为透明度(00~FF),可以根据需求修改,全透明为00
- packages\apps\Launcher3\res\values\congfig.xml
<integer name="extracted_color_gradient_alpha">153</integer>
取值范围为0~255
具体修改原因这里不多做介绍,“Read The Fucking Source Code!”
主菜单全透明比较完善的方案基于原生Launcher3,需要的拿走
SampleCode.diff
diff --git a/res/layout/all_apps_icon.xml b/res/layout/all_apps_icon.xml
index 79fb6126a..e8fbf71f3 100644
--- a/res/layout/all_apps_icon.xml
+++ b/res/layout/all_apps_icon.xml
@@ -16,7 +16,7 @@
<com.android.launcher3.BubbleTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
- style="@style/BaseIcon"
+ style="@style/BaseIcon.Workspace"
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml
index f4ccde1eb..818f98490 100644
--- a/res/layout/search_container_all_apps.xml
+++ b/res/layout/search_container_all_apps.xml
@@ -50,8 +50,8 @@
android:layout_marginLeft="@dimen/all_apps_search_bar_max_padding"
android:layout_marginRight="@dimen/all_apps_search_bar_max_padding"
android:singleLine="true"
- android:textColor="?android:attr/textColorSecondary"
- android:textColorHint="@drawable/all_apps_search_hint"
+ android:textColor="?attr/workspaceTextColor"
+ android:textColorHint="?attr/workspaceTextColor"
android:textSize="16sp" />
<!-- This needs to be a container with a view, to simulate a scrolling effect for the header.
@@ -66,6 +66,6 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
- android:background="@drawable/all_apps_search_divider"/>
+ android:background="?attr/workspaceTextColor"/>
</FrameLayout>
</com.android.launcher3.allapps.search.AppsSearchContainerLayout>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c4ff9bdf0..ea0dd01b0 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -114,7 +114,7 @@
<item name="android:gravity">center_horizontal</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/workspaceTextColor</item>
<item name="android:fontFamily">sans-serif-condensed</item>
<!-- No shadows in the base theme -->
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 743b16ef1..d4dd349de 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -289,7 +289,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
boolean forceChange = FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS ?
shift <= mShiftRange / 4 :
shift <= mStatusBarHeight / 2;
- if (forceChange) {
+ if (false) {
mLauncher.getSystemUiController().updateUiState(
SystemUiController.UI_STATE_ALL_APPS, !mIsDarkTheme);
} else {
diff --git a/src/com/android/launcher3/graphics/GradientView.java b/src/com/android/launcher3/graphics/GradientView.java
index 5455b43ec..abc11bef9 100644
--- a/src/com/android/launcher3/graphics/GradientView.java
+++ b/src/com/android/launcher3/graphics/GradientView.java
@@ -160,24 +160,24 @@ public class GradientView extends View implements WallpaperColorInfo.OnChangeLis
@Override
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.drawRect(mFinalMaskRect, paint);
-
- if (DEBUG) {
- mDebugPaint.setColor(0xFF00FF00);
- canvas.drawLine(0, startMaskY, mWidth, startMaskY, mDebugPaint);
- canvas.drawLine(0, startMaskY + mMaskHeight, mWidth, startMaskY + mMaskHeight, mDebugPaint);
- }
+// 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.drawRect(mFinalMaskRect, paint);
+//
+// if (DEBUG) {
+// mDebugPaint.setColor(0xFF00FF00);
+// canvas.drawLine(0, startMaskY, mWidth, startMaskY, mDebugPaint);
+// canvas.drawLine(0, startMaskY + mMaskHeight, mWidth, startMaskY + mMaskHeight, mDebugPaint);
+// }
}
public Bitmap createDitheredAlphaMask() {