发布于 2017-09-19 02:06:22 | 83 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Android移动端操作系统

Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。


这篇文章主要介绍了Android环形进度条(安卓默认形式)实例代码的相关资料,需要的朋友可以参考下

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

.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="查找网络"/>
</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) {
//创建我们的进度条
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环形进度条(安卓默认形式)的相关知识,希望对大家有所帮助!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务