package cppandi.apjquotes;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
public class MainSplashScreen extends Activity {
/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 5000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.front);
/* New Handler to start the Menu-Activity
* and close this Splash-Screen after some seconds.*/
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
/* Create an Intent that will start the Menu-Activity. */
Intent mainIntent = new Intent(MainSplashScreen.this,MainActivity.class);
MainSplashScreen.this.startActivity(mainIntent);
MainSplashScreen.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}
を実行している第二の活動の後に来ていることは私のfront.xmlここ私は私のアプリでスプラッシュ画面を取得しておりません、だけで空白の画面がここ
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/front"
android:id="@+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
である私たManifest.xml
です<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cppandi.apjquotes">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainSplashScreen"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="@string/app_name">
</activity>
<activity android:name=".quotes"
android:label="@string/app_name">
</activity>
<activity android:name=".about"
android:label="@string/app_name">
</activity>
</application>
それが5秒間白い画面のように表示され、それが次のアクティビティ「Mainactivitに起こっている私のAndroidアプリを開いた後y "しかし、front.xmlの画像は表示されません。
でそれを置き換えることができます?これはただで5秒の遅延を与えますあなたがメインアプリに入る前にロードするものがあれば、アプリは良いではありません、スプラッシュ画面を行います。 – Redman
ええ、スプラッシュ画面に表示するロゴがあります – Chitrapandi