пятница, 24 июня 2011 г.

Customizing Android ProgressBar

To customize standart ProgressBar You need to add in drawables-dpi image custom_spinner_image.png.



And create spinner_png.xml:
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/custom_spinner"
    android:pivotX="50%"
    android:pivotY="50%"
    />
And in Your layouts ProgressBar can be described as:
<ProgressBar android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:indeterminateOnly="true"
    android:indeterminateDrawable="@drawable/spinner_png"
/>
Result:
Or You can use only xml:
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%"
    android:pivotY="50%"
>
    <shape android:shape="ring" android:innerRadiusRatio="4"
      android:thicknessRatio="5.333" android:useLevel="false">

      <size android:width="18dip" android:height="18dip" />

      <gradient android:type="sweep" android:useLevel="false"
        android:startColor="#006688cc" android:centerColor="#886688cc"
        android:endColor="#ff6688cc" android:centerY="0.50" />

    </shape>
</animated-rotate>
Result:

Комментариев нет:

Отправить комментарий