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:
- [Solved] Docker Startup Error: OCI runtime create failed container_linux.go380 starting container process
- [Solved] Nacos Serve Local Startup Error: Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCre
- SpringBoot Project Run Page Error: Whitelabel Error Page This application has no explicit mapping for /error
- [Solved] Springboot loads static page Error: whitelabel error page
- How to Solve Spring integrate Seata startup error
- The @value annotation of springboot adds the default value to solve the startup error caused by the non-existent key
- How to Solve appium Startup Error (Various Error Messages)
- [Solved] Tomcat startup error: sub-container startup failed
- How to Solve nacos Startup Error and Connect to MYSQL
- Solve the problem that some jar packages failed to download when Maven was packaged
- Android solution Java.util.concurrent.ExecutionException: com.Android.ide.common.process.ProcessException: exception
- SpringBoot—Error starting ApplicationContext. To display the auto-configuration report re-run your a
- Error starting ApplicationContext. To display the conditions report re-run your application with ‘de
- [Solved] kafka startup Error: ERROR Fatal error during KafkaServer startup. Prepare to shutdown
- Android studio compilation failed: java.util.concurrent.ExecutionException: com.android.ide.common.process.Process
- H2 memory database Oracle mode page error: rg.springframework.dao.InvalidDataAccessResourceUsageException: could not prepar
- kafka Environment Build and Startup Error: ERROR [KafkaServer id=1] Fatal error during KafkaServer startup. Prepare to shutdown
- [Solved] IDEA Start Maven Project Error: “Error starting ApplicationContext. To display the conditions report …”
- Kotlin activity Startup and Compile Error [How to Solve]
- The number of control threads and concurrency number of concurrent executor of Java starting gun