layout文件:

 <?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"
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="com.hanqi.testapp2.TestActivity4"
android:orientation="vertical"> <ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:progress="0"
android:secondaryProgress="0"
android:max="80"
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"/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="0"
android:max="80"
android:secondaryProgress="0"
android:id="@+id/se_1"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:rating="3.5"
android:isIndicator="true"/>
</LinearLayout>

java类代码:

 package com.hanqi.testapp2;

 import android.app.AlertDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.SeekBar; 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); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); 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","进度条停止拖动");
}
});
}
}

效果为:

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 进度条

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

  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. K2十年:专注BPM

    <聚·谋·变——K2中国用户大会> 导演:K2中国 主演:K2用户 时长:420分钟 票价:免费 上映日期:2015年7月17日 查看完整视频请关注K2官方微信账号

  2. (转载)重新对APK文件签名

    1.将证书(debug.keystore)复制到与需要重新签名的apk文件相同的目录下(如:复制到D:\Sign) 2.在cmd中切换到需要重新签名的apk文件的目录下 3.使用WinRAR打开要重新 ...

  3. DotNetBar v12.3.0.3 Fully Cracked

    PS: 博客园的程序出现问题,导致我的博客不能访问(转到登录页),而我自己由于 Cookies 问题,一直可以访问,所以一直未发现该问题. 感谢冰河之刃告知,thx! 更新信息: http://www ...

  4. Linux登陆和欢迎信息修改

    edit file: /etc/issue,/etc/motd 这样还改不了,生成的脚本在目录/etc/update-motd.d/中: 假如要打开一个文本文件,可以修改10-help-text: ( ...

  5. SharePoint表单和工作流 - Nintex篇(二)

    博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 试用版获得的示例网站是一个SharePoint 2010 Server版的网站,我们先来看一下Nintex整个一 ...

  6. 2013年7月份第4周51Aspx源码发布详情

    大型企业通用管理ERP源码  2013-7-26 [VS2010]2013.7.4更新内容:1.修复决策模式-客户等级不能保存问题.2.修复企业知识库有报错问题.3.修复运营模式-人力资源分析模块-在 ...

  7. c++中,bool与int 的区别

    菜鸟一枚,为了观察区别,特地运行了下面几个语句 /*阅读程序回答问题, 1.bool类型的false对应数值?true呢? 2.非0整数对应bool型的?0呢? */ #include<iost ...

  8. Python清理内存中的密码

    基本不太好搞.可以参考如下讨论: http://stackoverflow.com/questions/728164/securely-erasing-password-in-memory-pytho ...

  9. classPath

    问 spring mvc的web.xml中这个地方的classpath是什么意思? spring springmvc java swnuv 2015年09月25日提问 关注 5 关注 收藏 0 收藏, ...

  10. SVG 2D入门4 - 笔画与填充

    前面我们重点都在总结各类形状,文本和图片,接下来,我们还是和讨论canvas一样,总结一下颜色处理,也就是填充和边框效果:你会发现这里的内容与canvas基本上是一致的.这些属性既可以以属性的形式写在 ...