“Layar splash flutter” Kode Jawaban

Layar Splash Android

//MainActivity.java

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

//splashscreen.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class splashscreen extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splashscreen);

        //Splash Screen duration
        int secondsDelayed = 1;
        new Handler().postDelayed(new Runnable() {
            public void run() {
                startActivity(new Intent(splashscreen.this, MainActivity.class));
                finish();
            }
        }, secondsDelayed * 3000);
    }
}

//activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

//splashscreen.xml

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

    />
      
Source: https://github.com/Lunox-Code/SplashScreen
Lunox

Layar splash asli Flutter

dev_dependencies:
  flutter_native_splash: ^1.2.0

flutter_native_splash:
  image: assets/logo.png
  color: "#fafafa"

flutter pub run flutter_native_splash:create

flutter pub run flutter_native_splash:remove
Vast Vendace

Layar splash flutter

flutter_native_splash:
  color: "#EDBB99"
  image: assets/images/Appicon.png
  android: true
  ios: true
  
// run this in the Terminal window in flutter
//flutter clean && flutter pub get && flutter pub run flutter_native_splash:create
Mostafa Saad

Splash Screen Flutter


dependencies:
  splashscreen: ^1.2.0

Cloudy Chipmunk

Layar splash flutter

<meta-data
    android:name="io.flutter.embedding.android.SplashScreenDrawable"
    android:resource="@drawable/my_splash"
    />
bbkouty

Jawaban yang mirip dengan “Layar splash flutter”

Pertanyaan yang mirip dengan “Layar splash flutter”

Lebih banyak jawaban terkait untuk “Layar splash flutter” di Dart

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya