您的位置:首页 > 移动开发 > Android开发

android 4.1.2 launcher2实现像4.4launcher3应用列表背景透明的效果

2014-08-19 16:27 721 查看

由于做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文件,将

<com.android.launcher.AppsCustomizeTabHost

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"

android:background="#FF000000">

修改为:

<com.android.launcher.AppsCustomizeTabHost

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"

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);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: