如何在没有创建任何飞溅活动时增加启动画面的时间?
问题描述:
我还没有建立独立的活动启动画面,但增加了一个主题:如何在没有创建任何飞溅活动时增加启动画面的时间?
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/splash</item>
</style>
和刚刚更新的清单文件
<activity android:name=".MainActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
我飞溅的XML是:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/splash"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
我发现所有的答案只是为了增加时间与独立的飞溅活动。
答
这可能不是答案,只是想澄清一些事情(或将来访问此链接的人)。
你知道..大部分人认为Splash Screen
只是用于显示互动UI给用户。
但相信我,它比你的期望更有用。 它提供了一种独特的方式来初始化应用程序的资源和检查属性等。
您可以在用户与应用程序进行交互之前完成网络检查或需要完成的大量工作。
这就是启动画面的实际动机,不仅仅是显示应用程序标志或欢迎信息。
所以,保持简单。
现在,对于你..我会建议..使用单独的Activity
。 :)
+0
我打算写一些相关的东西,但后来害怕恐惧阻止了我。 –
+0
@LalitSinghFauzdar Oohhhhh ...很棒:D –
您需要一个单独的活动,在经过一段时间后将转换。否则......你如何期望能够做到这一点? – Shark
既然你的MainActivity既是主要活动,也是一个启动画面,另一种方法是在你的主要活动中放置代码,使代码保持“飞溅状态”一段时间,然后做它应该做的事情。 – Shark