欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android環(huán)形進(jìn)度條(安卓默認(rèn)形式)實(shí)例代碼

 更新時(shí)間:2016年03月01日 11:37:16   作者:baohanqing  
這篇文章主要介紹了Android環(huán)形進(jìn)度條(安卓默認(rèn)形式)實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下

Android開發(fā)中,有很多的功能在實(shí)際應(yīng)用中都起了很大的作用,比如android進(jìn)度條的實(shí)現(xiàn)方式,下面給大家介紹Android環(huán)形進(jìn)度條(安卓默認(rèn)形式),具體內(nèi)容如下所示:

.xml

<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:orientation="vertical"
tools:context=".MainActivity" >
<Button 
android:id="@+id/mybut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查找網(wǎng)絡(luò)"/>
</LinearLayout>

.java

package com.example.progressdialog;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private Button but=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.but=(Button) super.findViewById(R.id.mybut);
this.but.setOnClickListener(new OnClickListenerImp());
}
public class OnClickListenerImp implements OnClickListener{
public void onClick(View v) {
//創(chuàng)建我們的進(jìn)度條
final ProgressDialog proDia=new ProgressDialog(MainActivity.this);
proDia.setTitle("搜索網(wǎng)絡(luò)");
proDia.setMessage("請耐心等待");
proDia.onStart();
//匿名內(nèi)部類
new Thread(){
public void run(){
try{
Thread.sleep(3000);
}
catch(Exception e){
}
finally{
//匿名內(nèi)部類要訪問類當(dāng)中的數(shù)據(jù),該數(shù)據(jù)必須為final
proDia.dismiss();//隱藏對話框
}
}
}.start();
proDia.show();
}
}
}

以上內(nèi)容是小編給大家介紹的Android環(huán)形進(jìn)度條(安卓默認(rèn)形式)的相關(guān)知識,希望對大家有所幫助!

相關(guān)文章

最新評論