在iOS上,当应用程序加载时,你会创建一个加载屏幕,在安卓中是否有类似的事情。当我的应用程序加载时,我会看到一个黑屏,直到它打开。
发布于 2011-12-09 04:29:24
我不是iOS专家,但是如果你指的是闪屏,你可以这样做:
创建一个在清单中将其意图过滤器类别设置为启动器的活动...假设你叫它Splash:
<activity
android:label="@string/app_name"
android:name=".Splash" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>然后,在新的Activity onCreate中,执行postDelay以启动新的意图:
new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent();
intent.setClass(Splash.this, MyMainActivity.class);
Splash.this.startActivity(intent);
Splash.this.finish();
}
}, 3000); // splash will show for 3 seconds发布于 2011-12-09 04:28:02
只需使你的主(启动)屏幕成为一个ImageView (或任何你想让你的闪屏拥有的),然后调用StartActivity()来启动你真正的主屏幕。
发布于 2011-12-09 04:28:27
您可以使用在动画图像上显示的自定义视图来显示活动(使用LayoutInflater进行膨胀,并使用动画对其进行动画处理)。我就是这么做的。
https://stackoverflow.com/questions/8437176
复制相似问题