How to change Progress bar image in android

拥有回忆 提交于 2019-12-30 00:12:24

问题


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


回答1:


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:

  <?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%"/>

animation.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>


来源:https://stackoverflow.com/questions/9732912/how-to-change-progress-bar-image-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!