본문 바로가기

안드로이드

[ux,ui]커스텀 원형 로딩 progressBar 만들기

반응형

보통 원형 로딩의 색상 변경에 좋은 것 같다.


1. drawable에 다음과 같이 파일을 만든다.

progress.xml

<?xml version="1.0" encoding="utf-8"?>

<rotate xmlns:android="http://schemas.android.com/apk/res/android"

    android:fromDegrees="0"

    android:pivotX="50%"

    android:pivotY="50%"

    android:toDegrees="360" >


    <shape

        android:innerRadiusRatio="3"

        android:shape="ring"

        android:thicknessRatio="8"

        android:useLevel="false" >


    <size

        android:height="76dip"

        android:width="76dip" />


    <gradient

        android:angle="0"

        android:endColor="color/pink"

        android:startColor="@android:color/transparent"

        android:type="sweep"

        android:useLevel="false" />


    </shape>


</rotate>


2. 원하는 곳에 다음과 같은 프로그래스를 시전한다.

<ProgressBar

    style="?android:attr/progressBarStyleLarge"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_above="@+id/relativeLayout1"

    android:layout_centerHorizontal="true"

    android:layout_marginBottom="20dp"

    android:indeterminate="true"

    android:indeterminateDrawable="@drawable/progress" />

반응형