2011-11-14 5 views
5

私はAndroidの「ビジー」アニメーションを作りたいと思っています。デフォルトのAndroidローダーアニメーションを作成するにはどうすればよいですか?

enter image description here

+4

はStackOverflowのへようこそ。あなたは実際に質問をしませんでした。私はそれが "それをする方法"だと思いますか?とにかく、ちょっとした調査をして、ここに投稿する前にあなた自身で問題を解決しようとしてください。その後、正確に何がうまくいかなかったのか、何を試したのかを具体的な質問に投稿してください。小さなコードスニペット、あなたの試みのスクリーンショット、必要なものに応じた適切な長さの説明を含める*(1文は通常不十分です)*。ありがとう! –

+1

http://developer.android.com/reference/android/widget/ProgressBar.html – Selvin

答えて

3

Androidアプリケーションでこれが必要な場合は、ProgressBarを使用できます。これはsetIndeterminate()-methodを提供し、無限の回転円(あなたの例のようなもの)を表示します。

別のドロアブルが必要な場合はsetIndeterminateDrawable()-methodを使用できます。

あなたはこのスピニング円のアニメーション画像をしたい場合(例えば、あなたのAjaxのローディングプロセス用)、あなたはここで1見つけることができます:それはFrameAnimation http://www.ajaxload.info/

+1

ああああ、それは私が必要なものでした!どうもありがとうございました。 – sztembi

+0

それで、あなたは答えを受け入れるべきです。 –

1

だけで静止画像を使用して、それを回転させる:このように

。これはあなたに望ましい効果を与えます。

ImageView image = (ImageView) findViewById(R.id.refreshicon); 

float ROTATE_FROM = 0.0f; // from what position you want to rotate it 
float ROTATE_TO = 10.0f * 360.0f; // how many times you want it to rotate in one 'animation' (in this example you want to fully rotate -360 degrees- it 10 times) 

RotateAnimation r = new RotateAnimation(ROTATE_FROM, ROTATE_TO, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 
r.setDuration(7500); // here you determine how fast you want the image to rotate 
r.setRepeatCount(Animation.INFINITE); // how many times you want to repeat the animation 
r.setInterpolator(new LinearInterpolator()); // the curve of the animation; use LinearInterpolator to keep a consistent speed all the way 

image.startAnimation(r); 
関連する問題