android 动画

 这几天看了下开源中国的源码 ,里面很多东西 感觉以后可能用的上 ,我现在将其中的一些东西分离出来,写博客的目的只是将前人写出来的东西总结起来 ,以防自己忘记了 ,下面的这个是一个关于Android 动画的,动画的使用方式 是加载数据的时候使用的 ,简单的progressbar,之所以选这个 是因为我感觉他用起来很简单 ,不像其他的那些要在java文件中添加什么动画,什么布局 。这个是直接在布局中完成动画的显示,仅仅是用了个style属性 <ProgressBar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    style="@style/progress_dialog"
    

    /> 而style 属性

<style name="progress_dialog" parent="@android:style/Widget.ProgressBar.Large">

        <item name="android:indeterminate">@anim/loading</item>
        <item name="android:layout_width">21dp</item>
        <item name="android:layout_height">21dp</item>
        <item name="android:gravity">center</item>

    </style>

第一个indeterminate属性 类似显示进度条的属性 ,这个里面就是我们放的些动画的图片

<animation-list android:oneshot="false"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:duration="100" android:drawable="@drawable/loading_0" />
    <item android:duration="100" android:drawable="@drawable/loading_1" />
    <item android:duration="100" android:drawable="@drawable/loading_2" />
    <item android:duration="100" android:drawable="@drawable/loading_3" />
    <item android:duration="100" android:drawable="@drawable/loading_4" />
    <item android:duration="100" android:drawable="@drawable/loading_5" />
    <item android:duration="100" android:drawable="@drawable/loading_6" />
    <item android:duration="100" android:drawable="@drawable/loading_7" />
</animation-list> 

下面的些 属性很简单了

最后 就可以在界面上直接显示,隐藏了。

我想这个动画也可用在其他地方 ,


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值