Android常见控件— — —ProgressBar
ProgressBar用于在界面上显示一个进度条,表示我们的程序正在加载一些数据。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"> <ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/> <Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="progress消失"/> <Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="progress重现"/> </LinearLayout>

package com.example.uiwidgettest2; import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*; public class edittextActivity extends Activity{ private ProgressBar progressBar = null;
private Button btn1 = null;
private Button btn2 = null; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edittext); progressBar = (ProgressBar)findViewById(R.id.progress_bar);
btn1 = (Button)findViewById(R.id.button1);
btn2 = (Button)findViewById(R.id.button2); btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(progressBar.getVisibility() == View.VISIBLE){
progressBar.setVisibility(View.GONE);
}
}
}); btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(progressBar.getVisibility() == View.GONE){
progressBar.setVisibility(v.VISIBLE);
}
}
});
} }


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"> <ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
/> <Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="progress"/> </LinearLayout>

package com.example.uiwidgettest2; import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*; public class edittextActivity extends Activity{ private ProgressBar progressBar = null;
private Button btn1 = null; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edittext); progressBar = (ProgressBar)findViewById(R.id.progress_bar);
btn1 = (Button)findViewById(R.id.button1); btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int progress = progressBar.getProgress();
progress = progress+10;
if(progressBar.getProgress() <= 100){
progressBar.setProgress(progress);
}
}
}); } }

Android常见控件— — —ProgressBar的更多相关文章
- Android基础控件ProgressBar进度条的使用
1.简介 ProgressBar继承与View类,直接子类有AbsSeekBar和ContentLoadingProgressBar, 其中AbsSeekBar的子类有SeekBar和RatingBa ...
- Android -- 常见控件的小效果
1,EditText控件 ① 修改光标颜色 自定义drawable 创建cursor.xml文件 <?xml version="1.0" encoding="utf ...
- Android --> 常见控件
1.TextView 主要用于界面上显示一段文本信息 2.Button 用于和用户交互的一个按钮控件 //为Button点击事件注册一个监听器public class Click extends ...
- Android常见控件— — —ProgressDialog
package com.example.uiwidgettest2; import android.app.Activity;import android.app.AlertDialog;import ...
- Android常见控件— — —AlertDialog
package com.example.uiwidgettest2; import android.app.Activity;import android.app.AlertDialog;import ...
- Android:控件ProgressBar进度条
各种进度条属于 ProgressBar的子类 设置style: 环形进度条 style="?android:attr/progressBarStyleLarge" 横向进度条, ...
- Android常见控件— — —EditText
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...
- Android常见控件— — —Button
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...
- Android常见控件— — —TextView
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...
随机推荐
- eclipse 设置jsp页面为HTML5
window-preferences-web-jspFiles-Editor-Templates-jsp with html... 然后修改为<!DOCTYPE html>就行了
- AsyncTask的缺陷和注意事项
1. AsyncTask 主要是用来处理后台耗时操作,并将数据更新到主线程的一个工具类. AsyncTask的执行分为四个步骤,每一步都对应一个回调方法,这些方法不应该由应用程序调用,开发者需要做的就 ...
- MYSQL #1064错误
你的给出的代码里option为MYSQL关键字,不能直接写,需要用`包括起来(它为数字键1左边的键上的字符),为: `option` varchar(50) NOT NULL default ''
- Adding List Item Element At Runtime In Oracle Forms
Add combo list / drop down list item element at runtime in Oracle forms.SyntaxPROCEDURE ADD_LIST_ELE ...
- java中正则表达式基本用法
正则表达式是一种可以用于模式匹配和替换的规范,一个正则表达式就是由普通的字符(例如字符a到z)以及特殊字符(元字符)组成的文字模式,它 用以描述在查找文字主体时待匹配的一个或多个字符串.正则表达式作为 ...
- 运行时c函数
// 修改isa,本质就是改变当前对象的类名 object_setClass(self, [XMGKVONotifying_Person class]); // self动态添加关联 // ...
- Python编程练习题
1 求可用被17整除的所有三位数 for num in range(99,1000): if num % 17 == 0: print num ps:下面的写法和上面的写法性能的差距,上面好吧? fo ...
- Java注释@Override
@Override指定方法覆载.它可以强制一个子类必须覆盖父类的方法. package ch14; /** * Created by Jiqing on 2016/12/27. */ public c ...
- java中的标记接口
在java 中,RandomAccess和Cloneable .Serializable一样,都是标志性接口,不需要任何实现,只是又来表明其实现类具体有某种特质的,实现了Cloneable表明可以拷贝 ...
- 【转载,整理】域名CNAME解析配置,使用域名B作为域名A的CNAME记录值
最近有个需求,未备案的域名A,想解析到香港 或 国内的服务器上,但是由于未备案,直接使用cdn解析在国内访问会很慢 但是不想直接直接到ip,所以找到两个方法可以解决: 方案一:转移到其他服务器做301 ...