如何在android中更改进度条图像 [英] How to change Progress bar image in android

查看:21
本文介绍了如何在android中更改进度条图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将进度条更改为自定义可绘制对象.如何更改进度条的图像?

I would like to change the progress bar to a custom drawable. How do I change the image of the progress bar?

推荐答案

这是我的答案,我在 android 进度条中使用我的图像..

Here my answer, i use my image in android progress bar..

 <ProgressBar
        android:layout_width="60dp"
        android:layout_height="50dp"
        android:layout_centerInParent="true"
        android:indeterminate="true"
        android:indeterminateDrawable="@drawable/my_progress_indeterminate" />

my_progress_indeterminate.xml:

my_progress_indeterminate.xml:

  <?xml version="1.0" encoding="utf-8"?>
    <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" 
        android:drawable="@drawable/animation" 
        android:pivotX="50%"
        android:pivotY="50%"/>

动画.xml:

<?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/load" android:duration="50" />
    <item android:drawable="@drawable/load" android:duration="50" />
    <item android:drawable="@drawable/load" android:duration="50" />
     <rotate 
         xmlns:android="http://schemas.android.com/apk/res/android" 
         android:drawable="@drawable/load" 
         android:pivotX="50%" 
         android:pivotY="50%" 
         android:fromDegrees="330" 
         android:toDegrees="360" 
         android:repeatCount="1" />     

</animation-list>

这篇关于如何在android中更改进度条图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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