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 ...
随机推荐
- 【Ubuntu Java 开发环境搭建 】
配置环境变量 在终端下: sudo gedit /etc/profile 这里当然有些熟悉ubuntu的朋友也可以用 vim, 刚从windows转过来的朋友还是用gedit看着舒服写. ...
- jquery选择器返回值
jquery选择器$('selector')返回的不是数组,而是封装好的jquery对象.但这个对象有一个特别的地方,就是查询到的节点被以下标为属性,添加到了jquery对象上,所以它看起来像数组,因 ...
- 各类JavaScript插件
ZeroClipboard复制内容到剪切板(支持IE.FF.Chrome) ZeroClipboard.js ZeroClipboard.swf hotkeys键盘监听 jquery.hotkeys. ...
- codeforce 605B. Lazy Student
题意:n点,m条边.m条边里面标记为1的最小生成树的边,0为非最小生成树的边.给了每条边的权,如果能构成一个最小生成树则输出图,否则-1. 思路:先按权值小,为生成数边的顺序排序.(根据kruskal ...
- 关于java线程池 Ⅱ
上一篇翻译了线程池主要部分的api,经过一段时间的学习,这里记录一下这段时间对jdk自带线程池的学习成果. 为了方便说明,先放一张类图,包括了jdk线程池主要涉及到的类,为了条理清晰去掉了部分依赖和关 ...
- 可以使用Markdown了?
园子果然领先 1.标题类 一级标题 二级标题 三级标题 四级 六级 怎么可以用#号?上传上去看看 2.换行 第一行 换一行 在换一行 3.多个下划线 the_odd_egg odd 斜体用星号 4.删 ...
- 28个MongoDB NoSQL数据库的面试问答
MongoDB是目前最好的面向文档的免费开源NoSQL数据库.如果你正准备参加MongoDB NoSQL数据库的技术面试,你最好看看下面的MongoDB NoSQL面试问答.这些MongoDB NoS ...
- hdu 1437 天气情况【概率DP】
天气情况 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- nyoj 129 树的判定
并查集+欧拉 树的判定 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 A tree is a well-known data structure that is e ...
- [C语言 - 13] 运算符
算术运算符 运算符的优先级 括号 > 正负 > 数学运算 > 位运算 > 数学对比 > 逻辑对比 > 条件运算 > 赋值运算 A.赋值运算符 复合赋值运算 ...