android Launcher3应用列表修改透明背景

本教程详细介绍了如何将Launcher3应用列表背景修改为透明,包括修改res/layout/apps_customize_pane.xml文件和AppsCustomizeTabHost.java类中onTabChangedEnd()方法的步骤。实现过程简单易懂。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

将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<br> android:id="@+id/animation_buffer"
 android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000"
android:visibility="gone" />

修改为:

<frameLayout<br> 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步骤完之后,保存,编译,即可达到需要的效果。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值