控件_ProgressBar
进度条的风格:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"> <!--水平进度条 -->
<ProgressBar
android:id="@+id/oneBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> <!--默认大小的圆圈进度条 -->
<ProgressBar
android:id="@+id/twoBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
<!--非常小的圆圈进度条 -->
<ProgressBar
android:id="@+id/threeBar"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> <!--非常大的圆圈进度条 -->
<ProgressBar
android:id="@+id/fourBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> <!--默认大小的圆圈进度条 ,旋转方向为反方向-->
<ProgressBar
android:id="@+id/fourBar"
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> <!--非常小的圆圈进度条 ,旋转方向为反方向-->
<ProgressBar
android:id="@+id/fourBar"
style="?android:attr/progressBarStyleSmallInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> <!--非常大的圆圈进度条 ,旋转方向为反方向-->
<ProgressBar
android:id="@+id/fourBar"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/> </LinearLayout>
<!--
style=:设置进度条的风格
visibility=:设置进度条是否可见
-->
水平进度条的使用:
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar; public class Activity08 extends Activity {
//声明变量
private ProgressBar firstBar =null;
private ProgressBar secondBar = null;
private Button myButton = null;
private int i = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//根据控件的ID来取得代表控件的对象
firstBar = (ProgressBar)findViewById(R.id.firstBar);
secondBar = (ProgressBar)findViewById(R.id.secondBar);
myButton = (Button)findViewById(R.id.myButton); //myButton.setOnClickListener(new ButtonListener());
myButton.setOnClickListener(new Listener()); /*
boolean flag = firstBar.isIndeterminate();//该方法判断该进度条是水平的还是转圈的,如果是转圈的返回true,否则返回false
firstBar.incrementProgressBy(10);//该方法表示在当前进度值下增加10,(可以用于当不知道当前进度值的情况下,增加10)
secondBar.incrementSecondaryProgressBy(10);//该方法的含义同上,这是第二进度的
*/
}
/*
class ButtonListener implements OnClickListener{
@Override
public void onClick(View v) {
if(i==0){
//设置进度条处于可见的状态
firstBar.setVisibility(View.VISIBLE);
firstBar.setMax(150);//设置最大值
secondBar.setVisibility(View.VISIBLE);
}
else if(i<firstBar.getMax()){
//设置主进度条的当前值
firstBar.setProgress(i);
//设置第二进度条的当前值
firstBar.setSecondaryProgress(i+10);
//因为默认的进度条无法显示进行的状态
//secondBar.setProgress(i);
}
else{
//设置进度条处于不可见状态
firstBar.setVisibility(View.GONE);
secondBar.setVisibility(View.GONE);
} i+=10;
} }
*/
class Listener implements OnClickListener{
public void onClick(View v) {
firstBar.setVisibility(View.VISIBLE);
firstBar.setMax(150);//设置最大值
secondBar.setVisibility(View.VISIBLE);
firstBar.incrementProgressBy(10);
secondBar.incrementSecondaryProgressBy(20);
} }
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <!--"?android:attr/progressBarStyleHorizontal"(水平进度条的主要属性):
进度条最大值(max)
当前进度(progress)
次要进度的值(SecondaryProgress) <ProgressBar
android:id="@+id/firstBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:max="200"
android:progress="100"
android:secondaryProgress="150"
/>
-->
<ProgressBar
android:id="@+id/firstBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<ProgressBar
android:id="@+id/secondBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<Button
android:id="@+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="begin"
/>
</LinearLayout>
控件_ProgressBar的更多相关文章
- JS调用Android、Ios原生控件
在上一篇博客中已经和大家聊了,关于JS与Android.Ios原生控件之间相互通信的详细代码实现,今天我们一起聊一下JS调用Android.Ios通信的相同点和不同点,以便帮助我们在进行混合式开发时, ...
- HTML5 progress和meter控件
在HTML5中,新增了progress和meter控件.progress控件为进度条控件,可表示任务的进度,如Windows系统中软件的安装.文件的复制等场景的进度.meter控件为计量条控件,表示某 ...
- 百度 flash html5自切换 多文件异步上传控件webuploader基本用法
双核浏览器下在chrome内核中使用uploadify总有302问题,也不知道如何修复,之所以喜欢360浏览器是因为帮客户控制渲染内核: 若页面需默认用极速核,增加标签:<meta name=& ...
- JS与APP原生控件交互
"热更新"."热部署"相信对于混合式开发的童鞋一定不陌生,那么APP怎么避免每次升级都要在APP应用商店发布呢?这里就用到了混合式开发的概念,对于电商网站尤其显 ...
- UWP开发必备:常用数据列表控件汇总比较
今天是想通过实例将UWP开发常用的数据列表做汇总比较,作为以后项目开发参考.UWP开发必备知识点总结请参照[UWP开发必备以及常用知识点总结]. 本次主要讨论以下控件: GridView:用于显示数据 ...
- 【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~
一.写在前面 自使用android studio开始,就被它独特的依赖方式:compile 'com.android.support:appcompat-v7:25.0.1'所深深吸引,自从有了它,麻 ...
- 对百度WebUploader开源上传控件的二次封装,精简前端代码(两句代码搞定上传)
前言 首先声明一下,我这个是对WebUploader开源上传控件的二次封装,底层还是WebUploader实现的,只是为了更简洁的使用他而已. 下面先介绍一下WebUploader 简介: WebUp ...
- Windows API 设置窗口下控件Enable属性
参考页面: http://www.yuanjiaocheng.net/webapi/create-crud-api-1-put.html http://www.yuanjiaocheng.net/we ...
- VB.NET设置控件和窗体的显示级别
前言:在用VB.NET开发射频检测系统ADS时,当激活已存在的目标MDI子窗体时,被其他子窗体遮住了,导致目标MDI子窗体不能显示. 这个问题怎么解决呢?网上看到一篇帖子VB.NET设置控件和窗体的显 ...
随机推荐
- 跨域请求中预检请求options之坑
一.前言 因为跨域请求,浏览器可能(后面讲)会发送一次options请求,如果处理不好,跨域还是会gg的. 之前很少涉及跨域,涉及也是简单请求(下面阮老师文章中区别热简单请求和复杂请求),所以基本不会 ...
- [Luogu 3613] 睡觉困难综合征
Description 给定一棵 \(n\) 个点的树,每个点上有位运算 \(opt\) 和一个权值 \(x\),位运算有 &,|,^ 三种. 要求支持: 修改点 \(v\) 的 \(opt\ ...
- Bootstrap学习记录-1.Navigation
Bootstrap中的导航栏功能需要添加bootstrap.css.jquery.js.bootstrap.js,其中,jquery.js文件是bootstrap.js文件中必须的,否则就会抛出异常信 ...
- 命令查看当前电脑安装所有版本.NET Core SKD
dotnet --version 查看当前使用版本 dotnet --info 安装的所有版本 包括版本地址 也可用命令帮助 dotnet help
- [PHP] 算法-邻接矩阵图的广度和深度优先遍历的PHP实现
1.图的深度优先遍历类似前序遍历,图的广度优先类似树的层序遍历 2.将图进行变形,根据顶点和边的关系进行层次划分,使用队列来进行遍历 3.广度优先遍历的关键点是使用一个队列来把当前结点的所有下一级关联 ...
- [android] 手机卫士绑定sim卡
更新: 收不到启动广播,查看知乎,好像是说高版本的系统都禁止了 还可以通过adb发送开机广播 adb shell am broadcast -a android.intent.action.BOOT_ ...
- 【github&&git】6、SmartGit(试用期30后),个人继续使用的方法。
在我们做项目的过程中,我们会用到SmartGit这个软件来将本地的MAVEN项目push到国内的码云(https://git.oschina.net)或者是国外的github网站进行项目的管理,这个时 ...
- matlab中syms与sym有什么区别
syms x y %就是定了符号变量x y以后x y就可以直接使用了,有他们运算出来的结果也是符号变量 当然上面的也可以x=sym('x'),y=sym('y') sys('a+b')%就是将a+b转 ...
- Why does the C# compiler translate this != comparison as if it were a > comparison?
Question: I have by pure chance discovered that the C# compiler turns this method: static bool IsNot ...
- Linux常用基本命令:三剑客命令之-awk数组用法
AWK的数组用法跟javascript类似. 1,定义数组 awk 'BEGIN{a[0]="zhangsan";a[1]="lisi";print a[0]} ...