Why animated drawable doesn't appear

C0deX

New Member
I want to create animated drawable from 14 png images.I added the 14 images to all drawable- folders, and created a animated-list like below, but nothing appear, what is the problem ?circle.xml: \[code\]<animation-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/f1" android:duration="50" /> <item android:drawable="@drawable/f2" android:duration="50" /> <item android:drawable="@drawable/f3" android:duration="50" /> <item android:drawable="@drawable/f4" android:duration="50" /> <item android:drawable="@drawable/f5" android:duration="50" /> <item android:drawable="@drawable/f6" android:duration="50" /> <item android:drawable="@drawable/f7" android:duration="50" /> <item android:drawable="@drawable/f8" android:duration="50" /> <item android:drawable="@drawable/f9" android:duration="50" /> <item android:drawable="@drawable/f10" android:duration="50" /> <item android:drawable="@drawable/f11" android:duration="50" /> <item android:drawable="@drawable/f12" android:duration="50" /> <item android:drawable="@drawable/f13" android:duration="50" /> <item android:drawable="@drawable/f14" android:duration="50" /></animation-list>\[/code\]layout xml:\[code\]<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Button android:id="@+id/btnStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Start" /> <ImageView android:id="@+id/imgCircle" android:layout_width="wrap_content" android:layout_height="wrap_content" /></LinearLayout>\[/code\]java code:\[code\]package pit.opensource.animation;import android.app.Activity;import android.graphics.drawable.AnimationDrawable;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;public class CircleAnimationActivity extends Activity { /** Called when the activity is first created. */ Button btnStart; ImageView imgCircle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnStart = (Button)findViewById(R.id.btnStart); imgCircle = (ImageView) findViewById(R.id.imgCircle); imgCircle.setBackgroundResource(R.drawable.circle); AnimationDrawable ani = (AnimationDrawable) imgCircle.getBackground(); ani.start(); btnStart.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // ani.start(); } }); }}\[/code\]
 
Back
Top