请问在DialogFragment
中,是否可以更改ProgressDialog
的消息显示字体类型?
public class LoadFromCloudTaskFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
this.progressDialog = new ProgressDialog(this.getActivity());
this.progressDialog.setMessage(progressMessage);
this.progressDialog.setCanceledOnTouchOutside(false);
return progressDialog;
}
通过继承ProgressDialog
创建自定义类可能是其中一种方式。然而,我想知道是否有更好的替代方案?遗憾的是,我们没有ProgressDialog.Builder
。
我尝试过的其中一种替代方案是
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
this.progressDialog = new ProgressDialog(this.getActivity());
this.progressDialog.setMessage(progressMessage);
this.progressDialog.setCanceledOnTouchOutside(false);
Utils.setCustomFont(this.progressDialog.findViewById(android.R.id.message), Utils.ROBOTO_LIGHT_FONT);
return progressDialog;
}
但这会导致错误
android.util.AndroidRuntimeException: 添加内容之前必须调用requestFeature()