3

我想为我的 ProgressDialog 中的消息设置正确的重力。我试图:

dialog = new ProgressDialog(activity);
dialog.getWindow().setGravity(Gravity.RIGHT);
dialog.setMessage(loadDialogMessage); 

但是消息的严重性仍然设置在右侧。我怎样才能做到这一点 ?

4

1 回答 1

3

像这样的东西应该可以解决问题:

ProgressDialog dialog = new ProgressDialog(getActivity());
dialog.setMessage("42 is the answer to life the universe and everything");
dialog.show();
TextView tvMessage = (TextView)dialog.findViewById(android.R.id.message);
tvMessage.setGravity(Gravity.RIGHT);

我只是查看了源http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/app/ProgressDialog.java#147 并查看在 textview 的 id

于 2012-09-07T14:48:13.340 回答