Android_ProgressBar
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的更多相关文章
- 【转】Android--UI之ProgressBar--不错
原文网址:http://www.cnblogs.com/plokmju/p/android_progressbar.html 前言 开门见山,开篇明意.这篇博客主要讲解一下Android中Progre ...
- 【Android】ProgressBar
http://www.cnblogs.com/wangying222/p/5304990.html http://www.cnblogs.com/plokmju/p/android_ProgressB ...
随机推荐
- POJ 1017 Packets
题意:有一些1×1, 2×2, 3×3, 4×4, 5×5, 6×6的货物,每个货物高度为h,把货物打包,每个包裹里可以装6×6×h,问最少几个包裹. 解法:6×6的直接放进去,5×5的空隙可以用1× ...
- 14、AppWidget及Launcher
一.Launcher的简单研究 1 什么是Launcher Android系统启动后加载的第一个程序 . 这个程序是其他应用程序的入口 . Launcher构成: HomeScreen : (Work ...
- java 多线程下载
import java.io.ByteArrayOutputStream; import java.io.InputStream; public class StreamTool { /** * 把一 ...
- usb 驱动
usb 驱动学习总结: usb 采用分层的拓扑结构,金字塔型,最多是7层.usb 是主从结构,主和主或者从和从之间不能交换数据.理论上一个usb主控制器最多可接127个设备,协议规定每个usb设备具有 ...
- adb pull命令复制android数据库文件.db到电脑
1.win+r cmd进入命令行 2.cd 进入[sdk]/platform-tools目录下 3.执行下面命令行,复制xxx.db到F:/dest adb pull /data/data/[pack ...
- 声明了包的类Java命令找不到或无法加载主类
首先你需要配置环境变量: CLASSPATH=.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar java 命令会在 CLASSPATH 目录下找相应 ...
- A Tour of Go Interfaces are satisfied implicitly
A type implements an interface by implementing the methods. There is no explicit declaration of inte ...
- [css]《CSS知多少》
http://www.cnblogs.com/wangfupeng1988/p/4325007.html
- oscgit
Gitlab PaaS项目演示 git config --global user.name "你的名字或昵称" git config --global user.email &qu ...
- 常用SQL代码段
代码使用时须测试. --聚合函数 use pubs go select avg(distinct price) --算平均数 from titles where type='business' go ...