المتابعون

الجمعة، 7 سبتمبر 2018

Splash


anim




<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" >

    <scale        android:duration="2000"        android:fromXScale="0.3"        android:toXScale="1.0"        android:fromYScale="0.3"        android:toYScale="1.0"        android:pivotX="50%"        android:pivotY="50%" />
</set>

MainActyivity.java




import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;

public class Splash extends Activity {
ImageView imageView;
    /** Duration of wait **/    private final int SPLASH_DISPLAY_LENGTH = 1000;

    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.activity_splash);
        ImageView bun = (ImageView) findViewById(R.id.splashscreen);
        final Animation yAnim = AnimationUtils.loadAnimation(this, R.anim.zoom);
        bun.startAnimation(yAnim);
        /* New Handler to start the Menu-Activity         * and close this Splash-Screen after some seconds.*/        new Handler().postDelayed(new Runnable(){
            @Override            public void run() {
                /* Create an Intent that will start the Menu-Activity. */                Intent mainIntent = new Intent(Splash.this,MainActivity.class);
                Splash.this.startActivity(mainIntent);
                Splash.this.finish();
            }
        }, SPLASH_DISPLAY_LENGTH);
    }
}

Actyivity.xml





<?xml version="1.0" encoding="utf-8"?><android.support.constraint.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=".Splash">
    <ImageView android:id="@+id/splashscreen"        android:layout_width="wrap_content"        android:layout_height="fill_parent"        android:src="@drawable/bloogerlogo"        android:layout_gravity="center"/>

</android.support.constraint.ConstraintLayout>

ليست هناك تعليقات:

إرسال تعليق

اعلان