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. JSP文件上传代码

    一.首先建立一个上传的界面,取名为a.jsp,代码如下 <%@ page contentType="text/html; charset=utf-8" language=&q ...

  2. SQLite Helper (C#) zt

    http://www.codeproject.com/Articles/746191/SQLite-Helper-Csharp This small class (SQLiteHelper.cs) i ...

  3. 清理vs工程文件(python2.7)

    本文记录了两种方法,用于对vs目录的清理工作,这两种方法都是用python2.7实现的,一个是基于文件的扩展名,一个是基于文件的大小: 基于文件大小的清理脚本: #-*- coding:utf-8 - ...

  4. 解决js获取数据跨域问题,jsonP

    网上说了一些jsonp的示例,感觉都没用,最后研究了一下,调用腾讯的一个api.最后要加output=jsonp&callback=?这个,比较适用. var url = "http ...

  5. 使用 EasyBCD 安装Ubuntu 14.04 Error 15: file not found错误的解决方法

    今天安装Window7 和 Ubuntu 14.04 双系统时,出现如下异常,记录一下. 安装过程是参考 http://www.linuxidc.com/Linux/2014-04/100369.ht ...

  6. 自己安装的几个Eclipse插件

    http://eclipsenotepad.sourceforge.net This plugin has the simple objective to let developers write s ...

  7. ActivityNotFoundException: No Activity found to handle Intent

    代码如下: Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction ...

  8. 转载MSDN 在ASP.NET 中执行 URL 重写

    转载文章原网址 http://msdn.microsoft.com/zh-cn/library/ms972974.aspx 摘要:介绍如何使用 Microsoft ASP.NET 执行动态 URL 重 ...

  9. IEnumerable、IEnumerator与yield的学习

    我们知道数组对象可以使用foreach迭代进行遍历,同时我们发现类ArrayList和List也可以使用foreach进行迭代.如果我们自己编写的类也需要使用foreach进行迭代时该怎么办呢? IE ...

  10. 导出DC列表

    $DomainName = (gwmi win32_computersystem).Domain$dn0 = $DomainName.Split(".")[0]$dn1 = $Do ...