<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
>
<ProgressBar
Android: id = "@ + id/progress1"
Style = "? Android: attr/progressBarStyleHorizontal"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: visibility = "gone"
/>
<ProgressBar
Android: id = "@ + id/progress2"
Style = "? Android: attr/progressBarStyle"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: visibility = "gone"
/>
<Button
Android: id = "@ + id/load"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "quickforward"
/>
</LinearLayout> View Code
1 setContentView (R. layout. progressbar_1 );
2 setTitle ("progress bar ");
3 first = (ProgressBar) findViewById (R. id. progress1 );
4 second = (ProgressBar) findViewById (R. id. progress2 );
5 load = (Button) findViewById (R. id. load );
6 load. setOnClickListener (new Button. OnClickListener (){
7
8 @ Override
9 publicvoid onClick (View v ){
10 if (I = 0 ){
11 first. setVisibility (ProgressBar. VISIBLE );
12 second. setVisibility (ProgressBar. VISIBLE );
13} elseif (I <100 ){
14 first. setProgress (I );
15 first. setSecondaryProgress (I + 10 );
16} else {
17 first. setVisibility (ProgressBar. GONE );
18 second. setVisibility (ProgressBar. GONE );
19}
20 I = I + 10;
21}
22 });