android无法加载动画,无法取消动画加载在android

onPostExecute()我想显示一些动画加载使用android.But中使用asynctask即时通讯无法显示我期待的动画,更多我无法取消动画以及。 任何人都可以帮助我解决这个问题。无法取消动画加载在android

感谢您的宝贵时间!..

Show_AnimatedLoading.java

ImageView imageView;

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

imageView=(ImageView) findViewById(R.id.imageView1);

CustomLoad task = new CustomLoad();

task.execute();

}

public class CustomLoad extends AsyncTask

{

@Override

protected void onPreExecute() {

// TODO Auto-generated method stub

Show_animation();

}

private void Show_animation() {

// TODO Auto-generated method stub

Animation a = AnimationUtils.loadAnimation(Show_AnimatedLoading.this, R.anim.progress_anim);

a.setDuration(2000);

imageView.startAnimation(a);

a.setInterpolator(new Interpolator()

{

private final int frameCount = 50;

@Override

public float getInterpolation(float input)

{

return (float)Math.floor(input*frameCount)/frameCount;

}

});

}

@Override

protected Void doInBackground(Void... params)

{

// TODO Auto-generated method stub

return null;

}

@Override

protected void onPostExecute(Void result) {

// TODO Auto-generated method stub

imageView.clearAnimation();

}

}

Progress.xml

xmlns:android="http://schemas.android.com/apk/res/android"

android:fromDegrees="0"

android:toDegrees="360"

android:pivotX="50%"

android:pivotY="50%"

android:repeatCount="infinite" />

activity_main.xml中

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#000000">

android:id="@+id/imageView1"

android:layout_width="100dp"

android:layout_height="100dp"

android:layout_centerHorizontal="true"

android:layout_centerVertical="true"

android:contentDescription="@string/app_name"

android:src="@drawable/transp_load" />

android:id="@+id/imageView2"

android:layout_width="80dp"

android:layout_height="80dp"

android:layout_centerHorizontal="true"

android:layout_centerVertical="true"

android:contentDescription="@string/app_name"

android:src="@drawable/pc_logo_load" />

2014-06-23

prabu

+0

“但是我无法显示其即时通讯期待的动画”,你有什么期待? –

+0

即时通讯设法旋转一个图像 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值