进度条未全屏显示到自定义对话框中

时间:2014-03-15 09:37:42

标签: android android-dialog android-progressbar

在Java文件中:

Dialog dialog = new Dialog(Dashboard.this, R.style.FullHeightDialog);
dialog.setContentView(R.layout.progress_dialog);
dialog.show();

progress_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<com.xorin.ress.gprogressbar.SmoothProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pbar"
    style="@style/GNowProgressBar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:indeterminate="true" />

输出如下:

enter image description here

我想显示当前没有显示的全宽中心进度条..

1 个答案:

答案 0 :(得分:0)

使用ProgressDialog,如

Object localObject = new ProgressDialog(getParent());
    ((ProgressDialog) localObject).setTitle("");
    ((ProgressDialog) localObject).setMessage("Please wait...");
    ((ProgressDialog) localObject).setCancelable(true);
    ((ProgressDialog) localObject)
            .setOnCancelListener(new DialogInterface.OnCancelListener()      {
                public void onCancel(
                        DialogInterface paramAnonymousDialogInterface) { }