2016-08-10 18 views

答えて

3

一つの方法は、次のようにトゥイーンアニメーションを使用することです。あなたは白丸の画像をアニメーション化する必要がある場合は、次

ImageView image = (ImageView)findViewById(R.id.imageView); 
     Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.move); 
     image.startAnimation(animation1); 

を行う今、あなたはRES /アニメーション/移動中にアニメーションファイルを作成する必要があるようにあなたのケースでは、複数のanimファイル

Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.myanimation); 

セイを必要とします.xml

<?xml version="1.0" encoding="utf-8"?> 
<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator" 
    android:fillAfter="true"> 

    <translate 
     android:fromXDelta="0%p" 
     android:toXDelta="75%p" 
     android:duration="800" /> 
</set> 

これは一例です。これらの基本アニメーションを変更する方法を見つける必要があります。詳細についてはthisを参照してください。

0

あなたはこのようにGIF画像を使用して、代わりに通常のJPGまたはPNG画像であなたのスプラッシュ画面上でそれを使用することができ

+1

これはコメントです。 –

3

スプラッシュ画面にgifを使用するには

<pl.droidsonroids.gif.GifImageView 
    android:id="@+id/gifView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:src="@drawable/gif" 
    /> 

そして最後に、あなたのクラスファイル内:あなたの活動のレイアウトで

compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+' 

:あなたのbuild.gradleファイルで

private static int SPLASH_TIME_OUT = 1500; 
private boolean isInFront; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_splash_gif); 
    new Handler().postDelayed(new Runnable() { 

     @Override 
     public void run() { 
      // This method will be executed once the timer is over 

      if(isInFront) 
      { 
       // Start your app main activity 
       Intent i = new Intent(SplashScreen_Gif.this, MainMenuActivity.class); 
       startActivity(i); 
      } 

      // close this activity 
      finish(); 
     } 
    }, SPLASH_TIME_OUT); 
} 
関連する問題