<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context="com.example.administrator.android.TestActivity4"
android:orientation="vertical">
<!--进度条-->
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:progress="30"
android:secondaryProgress="67"
android:max="100"
android:id="@+id/pb_1"/>
<!-- 旋转进度条-->
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:id="@+id/pb_2"
android:visibility="gone"/>
<!-- 可拖动进度条-->
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="0"
android:secondaryProgress="0"
android:max="80"
android:id="@+id/se_1"/>
<!--星级进度条-->
<RatingBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numStars="10"
android:rating="5.5"
android:isIndicator="true"/>
</LinearLayout>
 package com.example.administrator.android;

 import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.Toast; public class TestActivity4 extends AppCompatActivity {
SeekBar se_1;
ProgressBar pb_1;
ProgressBar pb_2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test4); se_1 = (SeekBar)findViewById(R.id.se_1);
pb_1 = (ProgressBar)findViewById(R.id.pb_1);
pb_2 = (ProgressBar)findViewById(R.id.pb_2); se_1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
// 进度改变触发
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
//进度条1的进度值
pb_1.setProgress(progress);
//判断是否达到最大值
if (progress==se_1.getMax())
{
pb_2.setVisibility(View.INVISIBLE); //不显示 但位置仍然保留
}
else
{
pb_2.setVisibility(View.VISIBLE);
}
// 只要progress变化就被触发
// Toast.makeText(TestActivity4.this, "当前进度 = "+progress, Toast.LENGTH_SHORT).show();
}
// 开始拖动
@Override
public void onStartTrackingTouch(SeekBar seekBar) { Log.e("TAG","进度条开始拖动");
}
// 结束拖动
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Log.e("TAG","进度条停止拖动");
}
});
}
}
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.android"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
</activity>
<activity android:name=".TestActivity4">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

Android 进度条的更多相关文章

  1. 多种的android进度条的特效源码

    多种的android进度条的特效源码,这个源码是在源码天堂那个网站上转载过来的,我已经修改一部分了,感觉很实用的,大家可以学习一下吧,我就不上传源码了,大家可以直接到那个网站上下载吧. 源码天堂下载地 ...

  2. android进度条

    android进度条 1.达到的效果 2.布局代码 先写一个my_browser.xml文件 存放WebView <?xml version="1.0" encoding=& ...

  3. Android 进度条改变图片透明度

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  4. Android—进度条

    layout文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...

  5. Android——进度条ProgressBar

    1.activity_progressbar.xml <?xml version="1.0" encoding="utf-8"?><Linea ...

  6. android进度条的使用

    // 导入按钮事件  btnsearch.setOnClickListener(new View.OnClickListener() {      @Override   public void on ...

  7. Android 进度条按钮实现(ProgressButton)

    有些App在点击下载按钮的时候,可以在按钮上显示进度,我们可以通过继承原生Button,重写onDraw来实现带进度条的按钮. Github:https://github.com/imcloudflo ...

  8. Android 进度条对话框ProgressDialog

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  9. Android进度条控件ProgressBar使用

    ProgressBar有四种样式,圆形的(大,中,小)和直条形的(水平) 对应的style为 <LinearLayout xmlns:android="http://schemas.a ...

随机推荐

  1. 夺命雷公狗—angularjs—10—angularjs里面的内置函数

    我们没学一门语言或者框架,几乎里面都有各自的语法和内置函数,当然,强悍的angularjs也不例外,他的方法其实常用的没多少,因为很多都可以用源生jis几乎都能完成一大部分.. <!doctyp ...

  2. [Ubuntu] Install subversion1.8 on Ubuntu13.10

    Subversion1.8 is difference far away from subversion1.7, here is the steps to install subversion1.8. ...

  3. 使用sublime text3的一些事

    因为在第一次接触网页设计的时候,使用的是Dreamweaver,它的设计是一款所见即所得的网页编辑器,而且当你写好元素之后的“:”时,就会有代码提示功能,对一些初学者来说,是一个不错的选择.但是慢慢地 ...

  4. 图像处理控件ImageGear for .NET教程如何为应用程序 添加DICOM功能(2)

    在前面的一些关于图像处理控件ImageGear for .NET文章<图像处理控件ImageGear for .NET教程: 添加DICOM功能(1)>中讲解了如何对应用程序添加DICOM ...

  5. linux设备驱动归纳总结(六):2.分享中断号【转】

    本文转载自:http://blog.chinaunix.net/uid-25014876-id-90837.html xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...

  6. windows cmd color setup

    设置颜色的话,一般可定会有foreground和background color设置:(其实color /?直接看一下就好了) Color Background Foreground Black 0 ...

  7. Oracle集合运算符 交集 并集 差集

     集合运算符:UNION/UNION ALL 并集,INTERSECT 交集,MINUS 差集  一.union求并集,公共部分只有包含一次 例:求emp表ename中含’A‘或含有‘M’ SQL&g ...

  8. 【JQGRID DOCUMENTATION】.学习笔记.2.基本表格

    JqGrid的实例是一个JavaScript对象,带有属性,事件和方法.属性可以是字符串,数字,数组,布尔值或任何其他对象. 1 调用的约定: $("#grid_id").jqGr ...

  9. org.apache.commons.httpclient

    org.apache.commons.httpclient /** * post 方法 * @param url * @param params * @return */ public static ...

  10. 面向生产环境的大集群模式安装Hadoop

    一.实验说明 1.本实验将使用DNS而不是hosts文件解析主机名: 2.使用NFS共享密钥文件,而不是逐个手工拷贝添加密钥: 3.复制Hadoop时使用批量拷贝脚本而不是逐台复制. 测试环境: Ho ...