Android 进度条
<?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 进度条的更多相关文章
- 多种的android进度条的特效源码
多种的android进度条的特效源码,这个源码是在源码天堂那个网站上转载过来的,我已经修改一部分了,感觉很实用的,大家可以学习一下吧,我就不上传源码了,大家可以直接到那个网站上下载吧. 源码天堂下载地 ...
- android进度条
android进度条 1.达到的效果 2.布局代码 先写一个my_browser.xml文件 存放WebView <?xml version="1.0" encoding=& ...
- Android 进度条改变图片透明度
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- Android—进度条
layout文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...
- Android——进度条ProgressBar
1.activity_progressbar.xml <?xml version="1.0" encoding="utf-8"?><Linea ...
- android进度条的使用
// 导入按钮事件 btnsearch.setOnClickListener(new View.OnClickListener() { @Override public void on ...
- Android 进度条按钮实现(ProgressButton)
有些App在点击下载按钮的时候,可以在按钮上显示进度,我们可以通过继承原生Button,重写onDraw来实现带进度条的按钮. Github:https://github.com/imcloudflo ...
- Android 进度条对话框ProgressDialog
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- Android进度条控件ProgressBar使用
ProgressBar有四种样式,圆形的(大,中,小)和直条形的(水平) 对应的style为 <LinearLayout xmlns:android="http://schemas.a ...
随机推荐
- 夺命雷公狗---TP商城----TP之配置环境---1
下载到tp3.2.3版本后架设到自己的wamp环境下,然后配置虚拟主机,完事后直接开工 环境下创建一个文件夹,然后里面存放这这两个文件即可开始新的旅途了 这里完了,下一步就开始配置index.php文 ...
- 为centos添加额外的源
使用这个命令: yum install epel-release
- sql语句删除数据表重复字段的方法
大家都可能遇到字段重复的情况,网上很多人在找方法,也给出了一些方法,但是有的方法是误导大家,铁牛写出以下方法,方便大家使用 1.通过group by把重复的字段筛选出来,并建立临时表tmp 1 cre ...
- GLSL第一个程序
拿出来直接运行即可,可以直接理解什么是GLSL,之所以贴出来是因为很多文章写得乱七八糟,一面解释,一面贴代码,有必要吗??很多GLSL电子书都有很详细的解释的. 我的OpenGL框架代码可能和你的框架 ...
- NOIP200902分数线划定
NOIP200902分数线划定 描述 世博会志愿者的选拔工作正在 A 市如火如荼的进行.为了选拔最合适的人才,A 市对所有报名的选手进行了笔试,笔试分数达到面试分数线的选手方可进入面试.面试分数线根据 ...
- Openstack的vnc界面定制
先来看一下青云的vnc界面: 在来看一下openstack的自带的vnc界面: 区别于感受 本身原理是一样的,但是vnc上面的html布局不一样而已,但是青云的vnc界面给人的感受是:清晰提示,信息给 ...
- 编程之美_1.1 让CPU占用率曲线听你指挥
听到有人说让要写一个程序,让用户来决定Windows任务管理器的CPU占用率. 觉得很好奇.但第一个想法就是写个死循环.哈哈.不知道具体的占用率是多少,但至少能保证在程序运行时,CPU的占用率终会稳定 ...
- HttpWebRequest:百度定位当前位置解析
HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create("http://api.map.baidu.com ...
- Wall Street English
1月23号,报名Wall Street English!
- IOS5基础教程之一-----如何创建XCode项目
一.IOS的基础知识 1.只有一个应用程序正在运行.在IOS上,每一段时间内只能激活一个应用程序并在屏幕上显示. 2.只有一个窗口.只允许应用程序操作的一个窗口. 3.访问受限.只能在IOS为应用程序 ...