Я запускаю свое приложение с заставкой в течение 3 секунд, но сначала приложение запускается с пустым белым экраном, а затем собирается в качестве заставки в Android Studio. Я хочу, чтобы первое, что появилось при запуске приложения, это заставкаAndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.loginregister">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity"/>
<activity android:name=".RegisterActivity"/>
<activity android:name=".HomeScreenActivity"
android:label="@string/title_activity_home_screen"/>
</application>
SplashActivity.java код
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
public class SplashActivity extends Activity {
Handler handler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
handler=new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(SplashActivity.this,LoginActivity.class);
startActivity(intent);
finish();
}
},3000);
}
}
activity_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.android.loginregister.SplashActivity">
<ImageView
android:id="@+id/logo_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/start_activity"
android:scaleType="centerCrop" />
</RelativeLayout>
и при удалении заставкии начать его с LoginActivity, он также сначала начинается с белого пустого экрана и переходит к операции входа