温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Android开发如何实现Launcher3应用列表修改透明背景

发布时间:2021-07-08 18:35:29 来源:亿速云 阅读:250 作者:小新 栏目:移动开发

小编给大家分享一下Android开发如何实现Launcher3应用列表修改透明背景,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

具体如下:

Launcher时开机完成后第一个启动的应用,用来展示应用列表和快捷方式、小部件等。Launcher作为第一个(开机后第一个启动的应用)展示给用户的应用程序,其设计的好坏影响到用户的体验,甚至影响用户购机的判断。所以很多品牌厂商都会不遗余力的对Launcher进行深度定制,如小米的MIUI、华为的EMUI等。Android默认的Launcher没有过多的定制,更加简洁,受到源生党的追捧,Google的Nexus系列手机基本都是用的源生Launcher,目前Android源生的Launcher版本是Launcher3。

前面总结了一些常见的launcher3配置修改方法,这里来分析一下launcher3的应用列表背景的修改技巧。

将launcher3的应用列表背景修改为透明,与Launcher2略有不同,需要进行如下步骤:

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

<com.android.launcher3.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.launcher3.appscustomizetabhost
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:background="#00000000">

将动画部分

<frameLayout
android:id="@+id/animation_buffer" 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000"
android:visibility="gone" />

修改为:

<frameLayout
 android:id="@+id/animation_buffer" 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:visibility="gone" />

2、找到AppsCustomizeTabHost.java类中的onTabChangedEnd()方法,如下:

private void onTabChangedEnd(AppsCustomizePagedView.ContentType type) {
    int bgAlpha = (int) (255 * (getResources().getInteger(
      R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f));
    setBackgroundColor(Color.argb(bgAlpha, 0, 0, 0));
    mAppsCustomizePane.setContentType(type);
}

其中bgAlpha为透明度的参数,将其改为你需要的透明度即可,255为不透明,以上1、2步骤完之后,保存,编译,即可达到需要的效果。

看完了这篇文章,相信你对“Android开发如何实现Launcher3应用列表修改透明背景”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI