进度对话框消息文本在Android-M中不可见

时间:2015-12-11 13:52:31

标签: android progressdialog

进度对话框的消息文本不可见。请参阅随附的屏幕截图。 码:    dialog = ProgressDialog.show(this, "", getResources().getString(R.string.scan_devices), true);

请帮我解决此问题。

感谢。enter image description here

4 个答案:

答案 0 :(得分:0)

TRANSPORT_VPN

答案 1 :(得分:0)

试试这个:

ProgressDialog progressDialog =  ProgressDialog.show(ExtractCallData.this, "title", "Message",true);

OR

ProgressDialog progress = new ProgressDialog(this);
progress.setTitle("Loading");
progress.setMessage("Wait while loading...");
progress.show();
// To dismiss the dialog
progress.dismiss();

答案 2 :(得分:0)

progressDialog = new ProgressDialog(mContext);      
            progressDialog.setIndeterminate(true);
            progressDialog.setMessage(getResources().getString(R.string.scan_devices));
            progressDialog.show();

答案 3 :(得分:0)

无论你使用什么,甚至在Android-M中都能正常工作,我认为你传递的Context的问题使用正确的上下文。一旦尝试下一个也

    public static ProgressDialog progress(Context context, String msg, boolean isCancelable) throws Exception {
    try {
        final ProgressDialog mProgressDialog = new ProgressDialog(context);
        mProgressDialog.setMessage(msg);
        mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgressDialog.setCancelable(isCancelable);
        mProgressDialog.setCanceledOnTouchOutside(isCancelable);
        mProgressDialog.show();
        mProgressDialog.setOnKeyListener(new OnKeyListener() {

            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    mProgressDialog.dismiss();
                }
                return false;
            }
        });

        return mProgressDialog;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}