Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom indeterminate progress bar

I successfully have implemented this progress enter image description here

Using animation-list with resources like this: enter image description here enter image description here enter image description here

But problem is, that i can't impement half-heighted progress with this resources.

I have tried half-heighted resources with gravity centered vertically like this: enter image description here enter image description here enter image description here

But the result was enter image description here

Android pushed this progress to bottom. Any ideas how can I center my half-heited progress? Thx in advance.

@Antoine Marques I have tried nine-patch drawables, but i get somethink like this enter image description here

And here is my animation-list:

<item android:duration="200" android:drawable="@drawable/progressbar_indeterminate1_0" />

And resource example: enter image description here

like image 905
Sergey Brazhnik Avatar asked Jul 16 '26 09:07

Sergey Brazhnik


1 Answers

The solution to your problem is wrapping your custom progress drawable inside a ScaleDrawable :

<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/my_custom_progress"
    android:scaleGravity="center_vertical|center_horizontal"
    android:scaleHeight="100%"
    android:scaleWidth="100%" />
like image 157
Antoine Marques Avatar answered Jul 18 '26 23:07

Antoine Marques