ProgressBar进度条控件
来源:互联网 发布:外观专利能投诉淘宝吗 编辑:程序博客网 时间:2024/05/16 15:22
PregressBar可以用来设置进度,可以设置为圆圈形或者条形,案例图如下
<?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 style="?android:attr/progressBarStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:progress="30" /> <ProgressBar android:id="@+id/progress" style="?android:attr/progressBarStyleHorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:secondaryProgress="60" android:layout_marginTop="40dip" android:progress="30" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/btn_add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="增加" /> <Button android:id="@+id/btn_cutback" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="减少" /> </LinearLayout></LinearLayout>
activity代码
package progress.bar;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ProgressBar;public class ProgressBarActivity extends Activity implements OnClickListener { private Button btn_add; private Button btn_cutback; private ProgressBar progress; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btn_add=(Button)findViewById(R.id.btn_add); btn_cutback=(Button)findViewById(R.id.btn_cutback); progress=(ProgressBar)findViewById(R.id.progress); btn_add.setOnClickListener(this); btn_cutback.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.btn_add: //拿到当前进度 int currentProgress= progress.getProgress(); int prog = (int)( currentProgress*1.2); progress.setProgress(prog); break; case R.id.btn_cutback: //拿到当前进度 int currentProgress2= progress.getProgress(); int prog2 = (int)( currentProgress2*0.8); progress.setProgress(prog2); } }}
0 0
- [控件]ProgressBar进度条
- 进度条控件ProgressBar
- android 控件 进度条(ProgressBar)
- ProgressBar进度条控件
- 控件:进度条ProgressBar
- Android 控件之ProgressBar进度条
- Android 控件之ProgressBar进度条
- Android 控件之ProgressBar进度条
- Android 控件之ProgressBar进度条
- android控件之ProgressBar进度条
- Android 控件之ProgressBar进度条
- Android控件三(ProgressBar 进度条)
- C# 多线程使用progressBar进度条控件
- gtk progressbar 进度条控件的使用
- UI控件----ProgressBar进度条 实例总结
- C# 多线程使用progressBar进度条控件
- 【android控件学习笔记】ProgressBar进度条
- Android 控件之十:ProgressBar进度条
- po主去研究root了
- c++程序的内存格局
- HLSL编译工具—FXC
- 照顾小集期间的学习目标计划
- property标签区分字符串和OGNL表达式
- ProgressBar进度条控件
- 数据挖掘3---决策树的构造
- linux查看java jdk安装路径和设置环境变量
- git常用配置及别名设置
- 实习整理(五)
- Android 版本platform 与api的对应关系
- C++—特殊成员函数
- 韩顺平Linux笔记(六)——linux分区
- [LintCode]Maximum Subarray Difference