对进度Android上的背景动画形象? [英] Background animation image on ProgressBar on Android?

查看:209
本文介绍了对进度Android上的背景动画形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是适当的行动,当你需要改变一个进度条的背景图像取?我的意思是应该使用.gif图像,如:的http://2.bp.blogspot.com/-O7nsXfmgwSc/T6PQ0PVr6-I/AAAAAAAAAQI/-eXkEXj24-s/s1600/02.gif如果这样将条的前景颜色填充proccess在图像文件?是否有酒吧的背景创建动画的一种方式?我所瞄准的展示动画,只要这个过程不包括完整的酒吧。

What is the appropriate action to take when you need to change the background image of a ProgressBar? I mean should use a .gif image like : http://2.bp.blogspot.com/-O7nsXfmgwSc/T6PQ0PVr6-I/AAAAAAAAAQI/-eXkEXj24-s/s1600/02.gif and if so will the foreground color of the bar fill the image file during the proccess ? Is there a way of creating an animation for the background of the bar ? What i am aiming for is to show the animation for as long the process does not cover the full bar.

推荐答案

您需要得到这一切的gif帧图像作为个人,然后设置成动画列表中的XML文件中。

you need to get all this gif frame image as individual and then set into the animation-list in xml file.

下面是你anim_progress.xml文件code

Here is your anim_progress.xml file code

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" 
    android:oneshot="false">
    <item android:drawable="@drawable/i1" android:duration="500" />
    <item android:drawable="@drawable/i2" android:duration="500" />
    <item android:drawable="@drawable/i3" android:duration="500" />
    <item android:drawable="@drawable/i4" android:duration="500" />
    <item android:drawable="@drawable/i5" android:duration="500" />
    <item android:drawable="@drawable/i6" android:duration="500" />
    <item android:drawable="@drawable/i7" android:duration="500" />
    <item android:drawable="@drawable/i8" android:duration="500" />
</animation-list>

设置持续时间变化给动画形象如GIF流畅的效果

set the duration for change as smooth effect for giving animated image like gif

下面是$ C $下使用此文件

Here is the code for using this file

ImageView iv = new ImageView(this);
iv.setBackgroundResource(R.drawable.anim_progress);
final AnimationDrawable mailAnimation = (AnimationDrawable) iv.getBackground();
iv.post(new Runnable() {
    public void run() {
        if ( mailAnimation != null ) mailAnimation.start();
      }
});

的setContentView(IV);

setContentView(iv);

您可以从GIF文件的所有帧从该网站。

you can get all frames from gif file from this site.

http://gif-explode.com/

例如

<一个href="http://2.bp.blogspot.com/-O7nsXfmgwSc/T6PQ0PVr6-I/AAAAAAAAAQI/-eXkEXj24-s/s1600/02.gif">http://2.bp.blogspot.com/-O7nsXfmgwSc/T6PQ0PVr6-I/AAAAAAAAAQI/-eXkEXj24-s/s1600/02.gif

这个链接只是通过它,你会得到所有的帧图像

this link just pass it and you will get all the frame images

这篇关于对进度Android上的背景动画形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆