android 环形缓存,Android环形进度条(安卓默认形式)实例代码

Android开发中,有很多的功能在实际应用中都起了很大的作用,比如android进度条的实现方式,下面给大家介绍Android环形进度条(安卓默认形式),具体内容如下所示:

.xml

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

tools:context=".MainActivity" >

android:id="@+id/mybut"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="查找网络"/>

.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) {

//创建我们的进度条

final ProgressDialog proDia=new ProgressDialog(MainActivity.this);

proDia.setTitle("搜索网络");

proDia.setMessage("请耐心等待");

proDia.onStart();

//匿名内部类

new Thread(){

public void run(){

try{

Thread.sleep(3000);

}

catch(Exception e){

}

finally{

//匿名内部类要访问类当中的数据,该数据必须为final

proDia.dismiss();//隐藏对话框

}

}

}.start();

proDia.show();

}

}

}

以上内容是小编给大家介绍的Android环形进度条(安卓默认形式)的相关知识,希望对大家有所帮助!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值