0

[設定]>[表示]>[アニメーション]>[すべてのアニメーション]から手動で行うように、アプリでアニメーションを動的に有効にしたい。

追加されたコードを試しましたが、役に立ちませんでした。

Settings.System.putInt(getContentResolver(), Settings.System.WINDOW_ANIMATION_SCALE, 1);
Settings.System.putInt(getContentResolver(), Settings.System.TRANSITION_ANIMATION_SCALE, 1);

助けてください

イムラン

4

2 に答える 2

0

//アニメーションを宣言します

アニメーションanimationSlideInLeft、animationSlideOutRight;

//これで画像ビューをアニメーション化しています

   image1 = (ImageView)findViewById(R.id.image1);
   image2 = (ImageView)findViewById(R.id.image2);
   image3 = (ImageView)findViewById(R.id.image3);

   animationSlideInLeft = AnimationUtils.loadAnimation(this,
     android.R.anim.slide_in_left);
   animationSlideOutRight = AnimationUtils.loadAnimation(this,
     android.R.anim.slide_out_right);
   animationSlideInLeft.setDuration(1000);
   animationSlideOutRight.setDuration(1000);
   animationSlideInLeft.setAnimationListener(animationSlideInLeftListener);
   animationSlideOutRight.setAnimationListener(animationSlideOutRightListener);

   curSlidingImage = image1;
   image1.startAnimation(animationSlideInLeft);
   image1.setVisibility(View.VISIBLE);

//アニメーションリスナーを作成します

 AnimationListener animationSlideInLeftListener
 = new AnimationListener(){

  @Override
  public void onAnimationEnd(Animation animation) {
   // TODO Auto-generated method stub

   if(curSlidingImage == image1){
    image1.startAnimation(animationSlideOutRight);
   }else if(curSlidingImage == image2){
    image2.startAnimation(animationSlideOutRight);
   }else if(curSlidingImage == image3){
    image3.startAnimation(animationSlideOutRight);
   } 
  }

  @Override
  public void onAnimationRepeat(Animation animation) {
   // TODO Auto-generated method stub

  }

  @Override
  public void onAnimationStart(Animation animation) {
   // TODO Auto-generated method stub

  }};

//そしてpausはリスナーをクリアします

   @Override
 protected void onPause() {
  // TODO Auto-generated method stub
  super.onPause();
  image1.clearAnimation();
  image2.clearAnimation();
  image3.clearAnimation();
 }

ここからの参照

2.これは、res /anim/フォルダーにxmlを追加して実行できるものと同じです。

于 2013-03-16T04:26:14.330 に答える
0

アプリでできると思いますが、デバイスで使用している場合は、フラグを読み取ることができます。無効になっている場合は、設定パネルを開いてユーザーが有効にすることができます。

ソース: アニメーション有効

于 2013-03-16T04:11:25.133 に答える