Android ProgressBar的动画效果

本文介绍如何利用XML动画和补间动画在Android应用中创建自定义的进度条,包括旋转形式和补间动画两种实现方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ProgressBar


<ProgressBar
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:indeterminateDrawable="@drawable/progress_my_style"
  style="?android:attr/progressBarStyle"
/>

旋转形式:

<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@drawable/spinner_color"
  android:pivotX="50%"
  android:pivotY="50%"
  />

补间动画形式:

<?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/loading01"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading02"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading03"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading04"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading05"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading06"
        android:duration="150"/>
    <item
        android:drawable="@drawable/loading07"
        android:duration="150"/>

</animation-list>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值