본문 바로가기

Mobile/Android

[ Android ] Custom Progressbar 커스텀 프로그래스바 만들기

반응형
반응형



custom_progressbar.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="1800">

    <shape
        android:shape="ring"
        android:useLevel="false">

        <gradient
            android:endColor="@color/view_color"
            android:startColor="@color/progressbar"
            android:thicknessRatio="50"
            android:type="sweep"
            android:useLevel="false" />
    </shape>
    
</rotate>



MainActivity.class 

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
    }
}
반응형