ProgressBar的使用
来源:互联网 发布:商品订单管理系统源码 编辑:程序博客网 时间:2024/06/03 22:55
圆形:style="?android:attr/progressBarStyleLarge"
效果:
条形:style="?android:attr/progressBarStyleHorizontal"
效果:
xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" > <ProgressBar android:id="@+id/pb1" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:max="100" android:progress="30" /> <ProgressBar android:id="@+id/pb2" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="30" /> <Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="增加条形进度条"/> <TextView android:id="@+id/show" android:layout_width="match_parent" android:layout_height="wrap_content" /></LinearLayout>
java代码
package com.example.assembly;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;import android.widget.TextView;public class MainActivity extends Activity {private TextView showTv;private String str = "";private ProgressBar pb1, pb2;private Button btn;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);showTv = (TextView) findViewById(R.id.show);pb1 = (ProgressBar) findViewById(R.id.pb1);pb2 = (ProgressBar) findViewById(R.id.pb2);showTv.setText(pb2.getProgress() + "");btn=(Button) findViewById(R.id.btn);btn.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {pb2.setProgress(pb2.getProgress() + 10);showTv.setText(pb2.getProgress() + "");}});}}
总效果图:
0 0
- ProgressBar组件的使用
- ProgressBar的使用
- ProgressBar控件的使用
- ProgressBar的使用
- android ProgressBar的使用
- android ProgressBar的使用
- ProgressBar 的使用
- ProgressBar的简单使用
- ProgressBar的正确使用
- ProgressBar的简单使用
- Android ProgressBar的使用!
- progressbar 进度条的使用
- ProgressBar的使用
- ProgressBar的使用
- ProgressBar的使用
- Progressbar的使用
- ProgressBar的使用
- ProgressBar的简单使用
- Spring框架学习(一)
- Bootstrap使用模态框
- 【Linux shell】 Shell编程中的条件判断
- 软考嵌入式系统工程师知识点整理(计算机系统构成)
- Logback-学习笔记
- ProgressBar的使用
- git 退回到某個版本
- Haroopad Markdown 编辑器代码语法高亮支持
- UVA12563 - Jin Ge Jin Qu hao
- Linux 启动环境变量PATH设置
- 温故而知新系列:正则表达式
- Linux配置VNC Server
- 文件打包和解压缩
- 继承(一)