私はAndroidに少し慣れていませんが、VB.netにはかなり流暢です。スプラッシュスクリーンに関して2つの質問があります。
アプリケーションの起動時に起動するスプラッシュ画面を作成しようとしています。Frame-Animationsでそれを行うことができますが、使用したい効果(fadeIn)があるため、TransitionDrawableクラスを使用したいと思います。定義を変更した後、Frame-Animationに同じコードを使用しましたが、機能させることができません。私は何が間違っているのですか?
私がロードしているこのロゴは16枚の画像で構成されています。TransitionDrawableクラスを使用して、logo1からlogo2、logo3 ...、logo16に移動するにはどうすればよいですか?ループと「imageIds」の配列を使用して独自のフレームアニメーションを作成しようとしましたが、トランジションでは機能しません。助けていただければ幸いです。
これが私のコードです:
public class SplashScreenActivity extends Activity {
TransitionDrawable animation;
ImageView transImage;
Integer[] imageIds = { R.drawable.logo1, R.drawable.logo2,
R.drawable.logo3, R.drawable.logo4, R.drawable.logo5,
R.drawable.logo6, R.drawable.logo7, R.drawable.logo8,
R.drawable.logo9, R.drawable.logo10, R.drawable.logo11,
R.drawable.logo12, R.drawable.logo13, R.drawable.logo14,
R.drawable.logo15, R.drawable.logo16 };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
transImage = (ImageView) findViewById(R.id.splashImageView);
animation = (TransitionDrawable) getResources().getDrawable(R.anim.transition_list);
transImage.setBackgroundDrawable(animation);
transImage.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
finish();
startActivity(new Intent("com.V1.V1LogoSplash.V1LogoMainActivity"));
}
return false;
}; // END ONTOUCH
}); // END ONLISTSENER
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
super.onWindowFocusChanged(hasFocus);
animation.startTransition(3000);
finish();
}
}