Android实现欢迎页快速启动的方法

Android实现欢迎页快速启动的方法,第1张

概述Android欢迎页快速启动大家应该都知道,在默认情况下,AndroidApp在点击Applogo到App完全启动这之间会有一段时间空白期。那么如何做到在用户点击logo图标之后立即打开App的界面而不是一段白屏或黑屏呢?

AndroID 欢迎页快速启动

大家应该都知道,在默认情况下,AndroID App在点击App logo到App完全启动这之间会有一段时间空白期。那么如何做到在用户点击logo图标之后立即打开App的界面而不是一段白屏或黑屏呢?

设置xml

在drawable下建立welcome.xml

<?xml version="1.0" enCoding="utf-8"?><@R_393_3419@ xmlns:androID="http://schemas.androID.com/apk/res/androID"> <!--背景色--> <item androID:drawable="@color/white"/> <item>  <!--图片-->  <bitmap   androID:gravity="center"   androID:src="@mipmap/welcome_page"/> </item></@R_393_3419@>

设置style

<!-- Base application theme. --> <style name="Apptheme" parent="theme.AppCompat.light.DarkActionbar">  <!-- Customize your theme here. --> </style> <style name="WelcomeThem" parent="Apptheme">  <item name="androID:windowBackground">@drawable/welcome</item> </style>

清单文件中配置style

<!-- 欢迎页 -->  <activity   androID:name=".ui.WelcomeActivity"   androID:windowsoftinputMode="adjustnothing" androID:theme="@style/WelcomeThem">   <intent-filter>    <action androID:name="androID.intent.action.MAIN"/>    <category androID:name="androID.intent.category.LAUNCHER"/>   </intent-filter>  </activity>

Activity中不需要设置setContentVIEw()

public class WelcomeActivity extends AppCompatActivity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  Intent intent = new Intent(this,MainActivity.class);  startActivity(intent);  finish(); }}

不需要为你的SplashActivity设置一个视图,这个视图来自于主题,在主题中为你的SplashActivity设置UI就足够了。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对编程小技巧的支持。

总结

以上是内存溢出为你收集整理的Android实现欢迎页快速启动的方法全部内容,希望文章能够帮你解决Android实现欢迎页快速启动的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1146977.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存