본문 바로가기
프로그래밍 놀이터/안드로이드, Java

[Android/안드로이드] Progress Bar ( 프로그래스 바 )

by 돼지왕 왕돼지 2012. 2. 22.
반응형


안녕하세요 돼지왕 왕돼지입니다.
오늘은 Progress Bar ( 프로그레스 바 ) 에 대해 알아보겠습니다.


Progress Bar 의 모양


 - 원 모양 : 작업의 전체 분량을 미리 알 수 없을 때 사용. (default)
 - 막대 모양 : 작업 분량을 미리 알고 있을 때 사용
                  style = "?android:Attr/progressBarStyleHorizontal"
 



APIs


void setProgress (int progress)
void setSecondaryProgress (int secondaryProgress)
void incrementProgrssBy (int diff)
void incrementSecondaryProgressBy (int diff)




Example

 

<layout>

<ProgressBar
   android:id="@+id/progress"
   style="?android:attr/progressBarStyleHorizontal"
   android:layout_width="fill_parent"
   android:layout_height='wrap_content"
   android:max="100"           <!-- 최대치 -->
   android:progress="10"     <!-- 첫 위치 -->
   android:secondaryProgress="50"/>  <!-- 두번째 위치, 여린 색깔로 나타난다. -->
 <!-- round type progress bar의 경우 android:visibility = "T/F" 로 on/off 만 한다. -->

<java> 
ProgressBar mProg = (ProgressBar) findViewById(R.id.progrss);
mProg.incrementProgressBy(-2);
mProg.incrementProgrssBy(2);
mProg.incrementSecondaryProgressBy(-2);
mProg.incrementSecondaryProgressBy(2);
mProg.setVisibility(View.VISIBLE);  // Circular progress bar의 경우 주로
mProg.setVisibility(View.INVISIBLE);  

 
 
로그인 없이 추천 가능합니다. 손가락 꾸욱~

반응형

댓글