源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Android开发实现Launcher3应用列表修改透明背景的方法

  • 时间:2022-02-12 21:30 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Android开发实现Launcher3应用列表修改透明背景的方法
本文实例讲述了Android开发实现Launcher3应用列表修改透明背景的方法。分享给大家供大家参考,具体如下: Launcher时开机完成后第一个启动的应用,用来展示应用列表和快捷方式、小部件等。Launcher作为第一个(开机后第一个启动的应用)展示给用户的应用程序,其设计的好坏影响到用户的体验,甚至影响用户购机的判断。所以很多品牌厂商都会不遗余力的对Launcher进行深度定制,如小米的MIUI、华为的EMUI等。Android默认的Launcher没有过多的定制,更加简洁,受到源生党的追捧,Google的Nexus系列手机基本都是用的源生Launcher,目前Android源生的Launcher版本是Launcher3。 前面总结了一些常见的[url=http://www.1sucai.cn/article/127495.htm]launcher3配置修改方法[/url],这里来分析一下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相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/410.htm]Android开发入门与进阶教程[/url]》、《[url=http://www.1sucai.cn/Special/508.htm]Android调试技巧与常见问题解决方法汇总[/url]》、《[url=http://www.1sucai.cn/Special/398.htm]Android多媒体操作技巧汇总(音频,视频,录音等)[/url]》、《[url=http://www.1sucai.cn/Special/381.htm]Android基本组件用法总结[/url]》、《[url=http://www.1sucai.cn/Special/375.htm]Android视图View技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/371.htm]Android布局layout技巧总结[/url]》及《[url=http://www.1sucai.cn/Special/124.htm]Android控件用法总结[/url]》 希望本文所述对大家Android程序设计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部