출처 - http://www.cyworld.com/keis8_/4653130
프로그래스 바 (막대형)
<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"
android:layout_span="4"
/>
자바코드로 넣게 되면,
AttributeSet attributes = null;
ProgressBar mProgress = new ProgressBar(this,attributes, android.R.attr.progressBarStyleHorizontal);
mProgress.setMax(100);
mProgress.setProgress(10);
원형 프로그래스 (기본)
<ProgressBar
android:id="@+id/progcircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
/>
기본형의 경우 Start, Stop만 제어.
보이기 : mProgCircle.setVisibility(View.VISIBLE);
숨기기 : mProgCircle.setVisibility(View.INVISIBLE);
막대형의 경우 값 제어 가능.
값 감소 : mProgBar.incrementProgressBy(-2);
값 증가 : mProgBar.incrementProgressBy(2);
두번째 바 값 감소 : mProgBar.incrementSecondaryProgressBy(-2);
두번째 바 값 증가 : mProgBar.incrementSecondaryProgressBy(2);
제목 표시줄 우측에 원형 프로그래스 바 표시
생성자의 setContentView 위쪽에 아래 코드 추가.
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
보이기 : setProgressBarIndeterminateVisibility(true);
숨기기 : setProgressBarIndeterminateVisibility(false);
기타 첨부된 프로젝트 파일 참조.
'개발 > 안드로이드' 카테고리의 다른 글
안드로이드 WebView에서 <a> 태그에 대한 URL intercept (0) | 2011.06.17 |
---|---|
[Android] Intent 활용 예시 (0) | 2011.06.16 |
[android]블루투스(bluetooth) 통신 (0) | 2011.05.30 |
안드로이드 키보드 옵션 (0) | 2011.05.12 |
Manifest <activity> configChanges attribute. (0) | 2011.05.12 |
댓글