Android環(huán)形進(jìn)度條(安卓默認(rèn)形式)實例代碼
Android開發(fā)中,有很多的功能在實際應(yīng)用中都起了很大的作用,比如android進(jìn)度條的實現(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)知識,希望對大家有所幫助!
- Android實現(xiàn)環(huán)形進(jìn)度條
- Android自定義環(huán)形LoadingView效果
- Android自定義View實現(xiàn)環(huán)形進(jìn)度條的思路與實例
- Android實現(xiàn)計步進(jìn)度的環(huán)形Progress
- Android實現(xiàn)環(huán)形進(jìn)度條的實例
- Android實現(xiàn)環(huán)形進(jìn)度條代碼
- Android應(yīng)用中炫酷的橫向和環(huán)形進(jìn)度條的實例分享
- Android中制作進(jìn)度框和環(huán)形進(jìn)度條的簡單實例分享
- android自定義環(huán)形對比圖效果
相關(guān)文章
Android仿騰訊QQ實現(xiàn)滑動刪除 附源碼下載
仿騰訊QQ滑動刪除操作,這篇文章主要為大家詳細(xì)介紹了ListView滑動刪除的具體操作方法,感興趣的小伙伴們可以參考一下2016-07-07
FlowLayout流式布局實現(xiàn)搜索清空歷史記錄
這篇文章主要為大家詳細(xì)介紹了FlowLayout流式布局實現(xiàn)搜索清空歷史記錄,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-12-12
Android如何實現(xiàn)設(shè)備的異顯功能詳解
這篇文章主要給大家介紹了關(guān)于Android如何實現(xiàn)設(shè)備的異顯功能的相關(guān)資料,這篇文章通過示例代碼介紹的非常詳細(xì),對各位Android開發(fā)者們具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2022-02-02
Android Studio 4.0 正式發(fā)布在Ubuntu 20.04中安裝的方法
這篇文章主要介紹了Android Studio 4.0 正式發(fā)布如何在Ubuntu 20.04中安裝,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-06-06
android studio無法添加 bmob sdk依賴問題及解決方法
這篇文章主要介紹了android studio無法添加 bmob sdk依賴,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-05-05

