当前位置: 首页 > news >正文

网站app制作教程自助提交网站

网站app制作教程,自助提交网站,拓者设计官网网页版,人寿保险网站在很多PC软件或手机软件中#xff0c;我们都会看见 “加载中...” 类似的对话框#xff0c;当然#xff0c;在android应用程序中也是如此。如果我们想在android应用程序中使用这样的效果#xff0c;那么就需要用到ProgressDialog。首先#xff0c;我们来看一下ProgressDia…       在很多PC软件或手机软件中我们都会看见 “加载中...” 类似的对话框当然在android应用程序中也是如此。如果我们想在android应用程序中使用这样的效果那么就需要用到ProgressDialog。首先我们来看一下ProgressDialog这个类。        ProgressDialog类继承自AlertDialog类同样存放在android.app包中。ProgressDialog有两种形式一种是圆圈旋转形式一种是水平进度条形式选择哪种形式可以通过以下两个属性值来设定   static intSTYLE_HORIZONTAL           Creates a ProgressDialog with a horizontal progress bar.static intSTYLE_SPINNER           Creates a ProgressDialog with a ciruclar, spinning progress bar.注意当设置为水平进度条形式时进度的取值范围为0—10000。   ProgressDialog的构造方法有以下两种   ProgressDialog(Context context)            ProgressDialog(Context context, int theme)               除了构造方法外ProgressDialog还提供的如下的静态方法返回ProgressDialog对象   static ProgressDialogshow(Context context, CharSequence title, CharSequence message)            static ProgressDialogshow(Context context, CharSequence title, CharSequence message, boolean indeterminate)            static ProgressDialogshow(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)            static ProgressDialogshow(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, DialogInterface.OnCancelListener cancelListener)   需要留意的是第一个参数必须是目前运行的Activity的Context。          android的ProgressDialog必须要在后台程序运行完毕前以dismiss()方法来关闭取得焦点的对话框否则程序就会陷入无法终止的无穷循环中。在线程中不得有任何更改Context或parent View的任何状态文字输出等时间因为线程里的Context与View并不属于parent两者之间也没有关联。   我们以下面一个简单的程序来学习ProgressDialog的应用 public class MainActivity extends Activity {private Button buttonnull;public ProgressDialog dialognull;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);super.setContentView(R.layout.activity_main);this.button(Button)super.findViewById(R.id.button);this.button.setOnClickListener(new OnClickListener() { Overridepublic void onClick(View v) {final CharSequence strDialogTitleMainActivity.this.getString(R.string.str_dialog_title);final CharSequence strDialogBodyMainActivity.this.getString(R.string.str_dialog_body);//显示Progress对话框dialogProgressDialog.show(MainActivity.this,strDialogTitle,strDialogBody,true);new Thread(){Overridepublic void run(){try{//表示后台运行的代码段以暂停3秒代替sleep(3000);}catch (InterruptedException e) {e.printStackTrace();}finally{//卸载dialog对象dialog.dismiss();}}}.start();}});}} 该程序布局管理器仅需一个Button组件id为button即可此处不再给出。 注意为了代码更加符合规范本程序在strings.xml中定义了如下字符串资源 ?xml version1.0 encodingutf-8? resourcesstring nameapp_namedemo2/stringstring nameaction_settingsSettings/stringstring namehello_worldHello world!/stringstring nameexecute执行/stringstring namestr_dialog_title请稍等片刻/stringstring namestr_dialog_body正在执行.../string/resources 程序运行效果截图  转载于:https://www.cnblogs.com/dyllove98/archive/2013/06/09/3130042.html
http://wiki.neutronadmin.com/news/352994/

相关文章:

  • 网站添加备案信息网页制作培训苏州
  • 网站自己建机房深圳网站开发工程师
  • 网站建设实例下载wordpress目录只显示第一个图片
  • 怎么做网站管理系统seo如何分析网站
  • 牛街网站建设网站邮件系统建设招标
  • 第三方商城网站建设网站没有收录了
  • 可以不花钱做网站吗视频直播源码
  • 一流的镇江网站建设魔贝课凡seo课程好吗
  • 建设工程学部研究生培养网站湖南常德邮编
  • 腾讯云建站流程2023年10月爆发新冠
  • 福步外贸网站wordpress如何修改模板
  • 网站优化分析wordpress更好用吗
  • 网络建设网站有关知识高端轻奢品牌
  • 网站 整站 抓取深圳网站建设公司流程
  • 制定网站建设规划书软件推广简报
  • 中国国防新闻兰州企业网络推广优化
  • 企业网站模板 首页大图企业信息查询网官网
  • 长沙公司建设网站公司名字大全最新
  • 网站后台管理怎么进衡水精品网站建设价格
  • 天津百度关键词排名外贸网站建设seo优化
  • 中石油技术开发公司网站东莞做网站注意事项
  • 301的网站用什么来做连锁租车网站源码
  • 广州网站建设性价比网站域名查主机
  • 阿里云建立网站培训机构图片
  • 常州淄博网站优化软件库合集软件资料2024
  • 定制高端网站建设报价视频网站如何推广
  • 怎么免费网上做公司网站石狮网站建设费用
  • wordpress网站语言商业广告
  • 电商类网站建设需要多少钱互联网做什么行业前景好
  • 织梦网站漏洞修复哔哩哔哩免费网站观看