ProgressBar에서 수평으로 표시하려면 'style="?android:attr/progressBarStyleHorizontal" 을 사용한다.
1 2 3 4 5 | <ProgressBar android:id="@+id/progress_horizontal" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="wrap_content" /> | cs |
setMax 함수에는 최대값을, setProgress 함수에는 메인 진행률을 setSecondaryProgress 함수에는
서브 진행률을 지정할 수 있다.
1 2 3 4 5 6 7 8 9 10 | @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_horizontal); progressBar.setMax(100); progressBar.setProgress(30); progressBar.setSecondaryProgress(70); } | cs |
원형 ProgressBar의 경우 크기에 따라 세가지가 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <ProgressBar android:id="@+id/progress_small" style="?android:attr/progressBarStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" /> <ProgressBar android:id="@+id/progressbar" style="?android:attr/progressBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content" /> <ProgressBar android:id="@+id/progress_large" style="?android:attr/progressBarStyleLarge" android:layout_width="match_parent" android:layout_height="wrap_content" /> | cs |
'Android' 카테고리의 다른 글
[Android] Button 추가하기 (0) | 2019.03.05 |
---|---|
[Android] ProgressBar Customize (0) | 2019.03.04 |
[Android] gravity 속성 (0) | 2019.03.01 |
[Android] style 속성 사용 (0) | 2019.02.28 |
[Android] TextView에 긴 문자열 생략해서 표시하기 (0) | 2019.02.27 |