xml文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.app3.MainActivity2" > <ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="61dp"
android:layout_marginTop="45dp" android:indeterminate="true"/>
<!-- indeterminate 不确定 --> <ProgressBar
android:id="@+id/progressBar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/progressBar1"
android:layout_marginLeft="18dp"
android:layout_toRightOf="@+id/progressBar1" /> <ProgressBar
android:id="@+id/progressBar3"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/progressBar2"
android:indeterminateDrawable="@drawable/progress_bg"
android:layout_below="@+id/progressBar1" />
<!-- 自定义progressBar --> <ProgressBar
android:id="@+id/progressBar4"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/progressBar1"
android:layout_alignParentRight="true"
android:layout_below="@+id/progressBar1"
android:layout_marginTop="46dp"
android:max="100"
android:progress="50"
android:secondaryProgress="80" />
<!-- secondaryProgress 第二进度条进度值(缓冲) --> <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/progressBar4"
android:layout_alignRight="@+id/progressBar4"
android:layout_below="@+id/progressBar4"
android:text="对话框进度条"
android:onClick="showDialogProgress"/> </RelativeLayout>

源代码:

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window; public class MainActivity3 extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
     //设置特性以允许在应用程序的标题栏上显示进度条(条状)
     //requestWindowFeathre(WIndow.FEATURE_PROGRESS); //设置特性以允许在应用程序的标题栏上显示进度条(圆圈状)
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    //在标题栏上显示进度条(条状)
    // setProgressBarVisibility(true);
    //在标题栏上显示进度条(圆圈状)
setProgressBarIndeterminateVisibility(true);
setContentView(R.layout.activity_main3); }
/*
* 显示对话框进度条
*/
public void showDialogProgress(View v){
/*//创建对话框进度条
ProgressDialog pd = new ProgressDialog(this);
pd.setMax(100);
pd.setProgress(30);
//pd.setIndeterminate(false);
pd.setCancelable(true);//是否能被取消
pd.setTitle("下载对话框");
pd.setMessage("正在下载中");
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);//设置水平样式
pd.show();*/
//简洁对话框进度条
ProgressDialog pd2 = ProgressDialog.show(this, "download", "downLoading...",false);
} }

Android_ProgressBar的更多相关文章

  1. 【转】Android--UI之ProgressBar--不错

    原文网址:http://www.cnblogs.com/plokmju/p/android_progressbar.html 前言 开门见山,开篇明意.这篇博客主要讲解一下Android中Progre ...

  2. 【Android】ProgressBar

    http://www.cnblogs.com/wangying222/p/5304990.html http://www.cnblogs.com/plokmju/p/android_ProgressB ...

随机推荐

  1. dephi WaitForMultipleObjects 用法

    在Delphi中WaitForMultipleObjects的使用   procedure ThreadTest;stdcall; var Handles:TWOHandleArray; //Hand ...

  2. Failed to lunch test error when run with Appium (已解决)

    [2015-08-10 15:09:07 - androidtest1] Performing android.test.InstrumentationTestRunner JUnit launch[ ...

  3. winform中设置FormBorderStyle为None后点击任务栏自动最小化实现

    在winform编程中,有时候我们可能对窗体样式需要定义,不适用系统自带的样式,这样我们可以设置FormBorderStyle属性为None.但是设置了FormBorderStyle为None后,我们 ...

  4. 设计模式_Interpreter_解释器模式

    形象例子: 俺有一个<泡MM真经>,上面有各种泡MM的攻略,比如说去吃西餐的步骤.去看电影的方法等等,跟MM约会时,只要做一个Interpreter,照着上面的脚本执行就可以了.解释器模式 ...

  5. Git管理命令

     1.创建分支 git branch <分支名> 2.切换分支 git checkout <分支名> 创建并切换到该分支:git checkout -b <分支名> ...

  6. Jquery UI的datepicker插件使用方法

    原文链接;http://www.ido321.com/375.html Jquery UI是一个非常丰富的Jquery插件,并且UI的各部分插件可以独自分离出来使用,这是其他很多Jquery插件没有的 ...

  7. wuzhicms上传弹出层,如何返回数据到当前页面?

    我们要实现下面功能: 上传图片后,返回图片列表到页面: 点击开始上传后,自动返回结果到页面. 原理:通过openiframe打开上传弹出层. 其中: returntype 在这里是 2 www/res ...

  8. NOIP2004 合并石子

    二.合并果子 (fruit.pas/dpr/c/cpp) [问题描述] 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆.多多决定把所有的果子合成一堆. 每一次合并,多多 ...

  9. 为zend studio增加Extjs代码提示功能

    http://blog.163.com/liuhaijun_83/blog/static/61175622201223114216786/ 需要将其中的http://www.spket.com/upd ...

  10. mybatis代码生成器配置文件详解

    mybatis代码生成器配置文件详解 更多详见 http://generator.sturgeon.mopaas.com/index.html http://generator.sturgeon.mo ...