Android startup page (solve the problem of starting black and white screen)

Android Startup page (solve the problem of starting black and white screen)

The theme

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Background JPG -->
    <item name="android:background">@mipmap/splash_bg</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Layout 1 and 2 choose one
layout 1 and layout 2 choose one
layout 1 and layout 2
Layout 1

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/splash_bg"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#00000000">

        <!-- logo -->
        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_centerInParent="true"
            android:background="#00000000"
            android:src="@drawable/home_icon" />

    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#00000000" />

</LinearLayout>

Layout 2

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/splash_bg"
    android:orientation="vertical"/>

Java code

/**
 * Launch page
 */
public class LauncherActivity extends RongRTCBaseActivity {
    private CountDownTimer mTimer = new CountDownTimer(800, 800) {
        @Override
        public void onTick(long millisUntilFinished) {

        }

        @Override
        public void onFinish() {
            Intent intent = new Intent(LauncherActivity.this, LoginActivity.class);
            startActivity(intent);
            // overridePendingTransition(R.anim.act_in, R.anim.act_out);// activity Go to animation
            finish();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launcher);
        // Here you can do logo pop-up animation
        mTimer.start();
    }
}

Read More: