进度条对话框(ProgressDialog)分为圆形和横向两种类型。

方法:

onCreatDialog(int id);创建一个对话框,只有在第一次创建该ID标识的Dialog时执行

onCreatDialog(int id,Bundle args);同上,带参数

onPrepareDialog(int id,Dialog dialog);在onCreateDialog之后,每次在对话框被显示之前都执行

onPrepareDialog(int id,Dialog dialog,Bundle args);同上,带参数

showDialog(int id);显示对话框

showDialog(int id,Bundle args);显示对话框,带参数

dismissDialog(int id);隐藏对话框,不从Activity中移除,保留状态

 

在layout 中添加两个按钮。第一个id 设为click_1 ,显示圆形进度条  第二个id设为click_2 ,显示横向进度条

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6 
 7     <Button
 8         android:id="@+id/click_1"
 9         android:layout_width="wrap_content"
10         android:layout_height="wrap_content"
11         android:text="圆形进度条" />
12 
13     <Button
14         android:id="@+id/click_2"
15         android:layout_width="wrap_content"
16         android:layout_height="wrap_content"
17         android:text="横向进度条" />
18 
19 </LinearLayout>
Layout内容

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-11-07
  • 2021-04-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-09-18
  • 2022-02-07
  • 2021-10-25
相关资源
相似解决方案