Android进度条简单练习实例
来源:互联网 发布:印度教 基督教 知乎 编辑:程序博客网 时间:2024/06/02 20:44
<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=".MainActivity" > <ProgressBar android:id="@+id/ProgressBar1" android:layout_width="match_parent" android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal" /> <Button android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_below="@+id/ProgressBar1" android:text="主进度增加10"/> <Button android:id="@+id/button2" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_below="@id/button1" android:text="第二进度增加20"/> </RelativeLayout>
package com.example.progressbar_o1;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ProgressBar;public class MainActivity extends Activity {private ProgressBar progressBar1;private Button button1;private Button button2;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);progressBar1 = (ProgressBar) findViewById(R.id.ProgressBar1);button1 = (Button) findViewById(R.id.button1);button2 = (Button) findViewById(R.id.button2);FirstClick fist=new FirstClick();SenClick send=new SenClick();button1.setOnClickListener(fist);button2.setOnClickListener(send);/* * progressBar1.setMax(400); progressBar1.setProgress(300); * progressBar1.setSecondaryProgress(350); //判断是否垂直还是水平style true为垂直 * false为水平 boolean isfalg=progressBar1.isIndeterminate(); //主进度增加10 * progressBar1.incrementProgressBy(10); //第二进度增加10 * progressBar1.incrementSecondaryProgressBy(10); */}class FirstClick implements OnClickListener {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubprogressBar1.incrementProgressBy(10);}}class SenClick implements OnClickListener {@Overridepublic void onClick(View v) {// TODO Auto-generated method stubprogressBar1.incrementSecondaryProgressBy(20);}}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;}}
Android当中的进度条
ProgressBar 有两种进度条 一种垂直(圆圈) 一种水平(水平线)
SeekBar 拖拽进度条(MP3播放的哪种)
RatingBar 三角形(类是酒店评分)
SeekBar、和RatingBar都是 ProgressBar类的子类
ProgressBar的style
水平风格:Horizontal
小风格:Small
反方向风格:Inverse
小反向的风格:Small.Inverse
大反向风格:Large.Inverse
进度条的主要属性
进度条最大值:max
当前进度:progress
次要进度的值:SecondaryProgress
- Android进度条简单练习实例
- Android练习-----进度条(ProgressBar)
- android URL含进度条异步加载简单实例
- Android进度条实例
- android简单进度条
- sed简单实例练习
- Android实例练习
- Qt中进度条的简单实例
- android竖向进度条简单实现
- android 简单的缓冲进度条
- android 简单自定义环形进度条
- java socket简单实例练习
- [Android实例] android进度条对话框Demo
- Android的水平进度条和圆形进度条实例
- [Android实例] 自定义漂亮的圆形进度条
- android Handler控制进度条(ProgressBar)实例
- 进度条实例
- 进度条实例
- 浅谈如何做好网站的目录规划
- 关于ubuntu默认root密码
- for(:)的作用
- 黑马程序员---访问修饰符
- TCP之send函数研究
- Android进度条简单练习实例
- hdu 4635 Strongly connected (强连通分量)
- 打印机外设通信 原理
- 前端经验
- HDU1114 Piggy-Bank
- hdu 1233 还是畅通工程
- POJ 3083 Children of the Candy Corn
- Linux下I2C驱动分析
- iOS给背景添加点击事件