import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class MainHelloProgressBar extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 设置窗口进度条特性风格
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
// 设置进度条可见性
setProgressBarVisibility(true);
// 设置进度条进度值,要乘以100的
setProgress(60 * 100);
setSecondaryProgress(80 * 100);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#003399"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar04"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
最大刻度按100算=""
第一进度是30=""
android:max="100"
android:progress="30"
android:secondaryProgress="80" >
</ProgressBar>
</LinearLayout>