I need create a background and then on top of that the text boxes and images as Splash Screen. What my steps?
CodePudding user response:
You could use two activities. One activity is used to show the splash screen and the other used to show the mian activity.
splashscreen.xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/star"/>
<TextView
android:text="Splash Screen Star"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
SplashScreen_Activity:
public class SplashScreen_Activity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.splashscreen);
// Create your application here
}
protected override void OnResume()
{
base.OnResume();
Task startupWork = new Task(() => { SimulateStartup(); });
startupWork.Start();
}
// Simulates background work that happens behind the splash screen
async void SimulateStartup()
{
await Task.Delay(3000); // Simulate a bit of startup work.
StartActivity(new Intent(Application.Context, typeof(Activity5)));
}
}
Activity5 is the main activity i want to show. You could load the layout in Activity5.
CodePudding user response:
I really don't understand why you would be advising a user to use such an outdated technique of suggesting the use of SplashScreen Activity, for a splash screen when obviously there are far better techniques of achieving a SplashScreen. You are offering a solution that was even frowned upon back in 2016-16, let alone 2022.