Ich bin ein kompletter Neuling für Android. Wie kann ich die Hauptaktivität einblenden? Grundsätzlich, nachdem ich die App geöffnet habe, möchte ich den Bildschirm schwarz und dann ein Bild einblenden. Ich habe versucht, dies für die letzten 2 Stunden zu tun, und ich kann nicht scheinen, eine Lösung zu finden.Fade In Hauptaktivität
Dies ist mein Code:
package com.example.radu.gladiators2;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
/**
* Created by Radu on 8/8/2016.
*/
public class Splash extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
if (hasFocus) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}
}
Und dies ist der XML:
<?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">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash_image"
android:id="@+id/imageView"
android:scaleType="centerCrop" />
hier ein Beispiel http: // Stackoverflow .com/questions/18475826/Einblenden-Animation-auf-Aktivität-Übergang – ono
Ich habe versucht, es an mein Problem anzupassen, aber es scheint nicht an einer Hauptaktivität zu arbeiten. – Radu