博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Google 的Android Splash
阅读量:7058 次
发布时间:2019-06-28

本文共 1428 字,大约阅读时间需要 4 分钟。

first create an XML drawable in res/drawable.

Here, I’ve set up a background color and an image.

Next, you will set this as your splash activity’s background in the theme. Navigate to your styles.xml file and add a new theme for your splash activity::

In your new SplashTheme, set the window background attribute to your XML drawable. Configure this as your splash activity’s theme in your AndroidManifest.xml:

Finally, your SplashActivity class should just forward you along to your main activity:

public class SplashActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    Intent intent = new Intent(this, MainActivity.class);    startActivity(intent);    finish();}}

Notice that you don’t even set up a view for this SplashActivity. The view comes from the theme. When you set up the UI for your splash activity in the theme, it is available immediately.

If you did have a layout file for your splash activity, that layout file would be visible to the user only after your app has been fully initialized, which is too late. You want the splash to be displayed only in that small amount of time before the app is initialized.

form:

look:

转载地址:http://kumol.baihongyu.com/

你可能感兴趣的文章
使用NGINX Plus负载均衡Kubernetes服务
查看>>
iOS app设备日志查看
查看>>
阿里云游戏服务器价格-阿里云游戏服务器多少钱
查看>>
Gigamon全面产品系列增强技术领先优势
查看>>
免费申请基于飞腾硬件平台上的麒麟云试用!
查看>>
Linux内核通用队列的使用笔记(读linux内核设计与实现)
查看>>
摩拜AI大数据平台“魔方”发布黄金周骑行预测,加州开发 AI 智能公寓
查看>>
javascript的队列,优先队列,循环队列
查看>>
企业加快云计算应用的十大理由
查看>>
ACID
查看>>
centOS6.4 oracle11g RAC搭建
查看>>
ZABBIX作集中式NGINX性能监控的注意要点
查看>>
《数据虚拟化:商务智能系统的数据架构与管理》一 2.9 报告和分析的新形式...
查看>>
2017年Q2美国新增光伏装机2.4GW 同比增长8%
查看>>
中国人工智能学会通讯——一张图看懂BP算法 1.4 致谢
查看>>
《社交网站界面设计(原书第2版)》——第2章 2.0社交的核心
查看>>
直击英特尔IDF16:加速万物智能互联世界到来
查看>>
《中国人工智能学会通讯》——6.26 走向深度
查看>>
硅谷人工智能专家加盟销售易 为AI+CRM打开想象空间
查看>>
看虎牙Miss直播时最难受的是什么?
查看>>