android 4.1.2 launcher2实现应用列表背景透明

由于做android系统开发,在研发的平板上希望将launcher2的应用列表背景由黑色修改为透明,苦闷了几天,终于算是完美实现了,在此直接说方法,希望对想要此功能的人有用。

1.将launcher2的源码从packages/apps/Launcher2/下倒入到eclipse中,具体方法见: http://blog.csdn.net/singleton1900/article/details/8806978

2.待成功能编译出Launcher2后,开始修改代码。

3.找到res/layout/apps_customize_pane.xml文件,将

  1. <com.android.launcher.AppsCustomizeTabHost
  2.     xmlns:android="http://schemas.android.com/apk/res/android"
  3.     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
  4.     android:background="#FF000000">
修改为:

  1. <com.android.launcher.AppsCustomizeTabHost
  2.     xmlns:android="http://schemas.android.com/apk/res/android"
  3.     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
  4.     android:background="#00000000">
4.打开com/android/launcher/Launcher.java代码,将其中的对updateWallpaperVisibility函数的调用参数都修改为true.

5.编译运行,即可看到应用列表背景变为透明。

diff --git a/packages/apps/Launcher2/res/layout/apps_customize_pane.xml b/packages/apps/Launcher2/res/layout/apps_customize_pane.xml
index 41ba9e2..c83b5da 100644
--- a/packages/apps/Launcher2/res/layout/apps_customize_pane.xml
+++ b/packages/apps/Launcher2/res/layout/apps_customize_pane.xml
@@ -16,7 +16,7 @@
 <com.android.launcher2.AppsCustomizeTabHost
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
-    android:background="#FF000000">
+    android:background="#00000000">
     <LinearLayout
         android:id="@+id/apps_customize_content"
         android:orientation="vertical"
diff --git a/packages/apps/Launcher2/src/com/android/launcher2/Launcher.java b/packages/apps/Launcher2/src/com/android/launcher2/Launcher.jav
index 433b0ba..ccfbc44 100755
--- a/packages/apps/Launcher2/src/com/android/launcher2/Launcher.java
+++ b/packages/apps/Launcher2/src/com/android/launcher2/Launcher.java
@@ -2420,7 +2420,7 @@ public final class Launcher extends Activity
         if (isAllAppsVisible()) {
             if (mAppsCustomizeTabHost != null &&
                     !mAppsCustomizeTabHost.isTransitioning()) {
-                updateWallpaperVisibility(false);
+                updateWallpaperVisibility(true);
             }
         }
     }
@@ -2599,7 +2599,7 @@ public final class Launcher extends Activity
                         hideDockDivider();
                     }
                     if (!animationCancelled) {
-                        updateWallpaperVisibility(false);
+                        updateWallpaperVisibility(true);
                     }
 
                     // Hide the search bar
@@ -2693,7 +2693,7 @@ public final class Launcher extends Activity
             dispatchOnLauncherTransitionPrepare(toView, animated, false);
             dispatchOnLauncherTransitionStart(toView, animated, false);
             dispatchOnLauncherTransitionEnd(toView, animated, false);
-            updateWallpaperVisibility(false);
+            updateWallpaperVisibility(true);
         }
     }



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值