<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


更多相关文章

  1. Android实现冒泡效果进度条
  2. Android(安卓)自定义SeekBar显示进度百分比
  3. Android(安卓)使用View的旋转实现漂亮的动画效果
  4. 2011.10.13(4)——— android android:layout_weight
  5. Android中自定义水平的ProgressBar
  6. Android(安卓)下载进度条, 自定义加载进度条,loading动画
  7. 总结一下Android中主题(Theme)的正确玩法
  8. 2020-09-07
  9. android通知栏进度条

随机推荐

  1. Google手机Android操作系统面试题
  2. AndroidManifest.xml android:name(应用中
  3. Android根据包名取得指定程序包的信息(名
  4. Android(安卓)- 手机开发调试无法输出log
  5. Ubuntu16.04 LTS安装Android(安卓)studio
  6. Android(安卓)adb不是内部或外部命令 问
  7. Android(安卓)View(一)
  8. Android(安卓)开源动画框架:NineOldAndroi
  9. Android底部导航栏+消息提醒
  10. Android(安卓)数据存储之SharedPreferenc