<progressBar android:id="@+id/widget43" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical"> </ProgressBar>
style="?android:attr/progressBarStyleLarge"完整
<progressBar android:id="@+id/widget196" android:layout_width="wrap_content" android:layout_height="wrap_content" style="?android:attr/progressBarStyleLarge"> </ProgressBar>
style="?android:attr/progressBarStyleSmall"
<progressBar android:id="@+id/widget108" android:layout_width="wrap_content" android:layout_height="wrap_content" style="?android:attr/progressBarStyleSmall"> </ProgressBar>
style="?android:attr/progressBarStyleSmallTitle"完整XML定义是:
<progressBar android:id="@+id/widget110" android:layout_width="wrap_content" android:layout_height="wrap_content" style="?android:attr/progressBarStyleSmallTitle"> </ProgressBar>
protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); //请求窗口特色风格,这里设置成不明确的进度风格 setContentView(R.layout.second); setProgressBarIndeterminateVisibility(true); //设置标题栏中的不明确的进度条是否可以显示 }
<progressBar android:id="@+id/progressbar_updown" android:layout_width="200dp" android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal" android:layout_gravity="center_vertical" android:max="100" android:progress="50" android:secondaryProgress="70" />
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:progress="50"
android:secondaryProgress="70"
android:layout_gravity="center_vertical"
private ProgressBar myProgressBar; //定义ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progressbar_updown); //ProgressBar通过ID来从XML中获取 myProgressBar.incrementProgressBy(5); //ProgressBar进度值增加5 myProgressBar.incrementProgressBy(-5); //ProgressBar进度值减少5 myProgressBar.incrementSecondaryProgressBy(5); //ProgressBar背后的第二个进度条 进度值增加5 myProgressBar.incrementSecondaryProgressBy(-5); //ProgressBar背后的第二个进度条 进度值减少5
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main); setProgressBarVisibility(true);
setProgress(myProgressBar.getProgress() * 100);
setSecondaryProgress(myProgressBar.getSecondaryProgress() * 100);
ProgressDialog mypDialog=new ProgressDialog(this); //实例化 mypDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); //设置进度条风格,风格为圆形,旋转的 mypDialog.setTitle("Google"); //设置ProgressDialog 标题 mypDialog.setMessage(getResources().getString(R.string.second)); //设置ProgressDialog 提示信息 mypDialog.setIcon(R.drawable.android); //设置ProgressDialog 标题图标 mypDialog.setButton("Google",this); //设置ProgressDialog 的一个Button mypDialog.setIndeterminate(false); //设置ProgressDialog 的进度条是否不明确 mypDialog.setCancelable(true); //设置ProgressDialog 是否可以按退回按键取消 mypDialog.show(); //让ProgressDialog显示
ProgressBar 各种样式,布布扣,bubuko.com
原文:http://www.cnblogs.com/gtgl/p/3906620.html