gpt4 book ai didi

android - 将右引力设置为 ProgressDialog 内的消息

转载 作者:搜寻专家 更新时间:2023-11-01 09:05:20 28 4
gpt4 key购买 nike

我想为 ProgressDialog 中的消息设置正确的引力。我尝试过:

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

但消息的重力仍然设置在右边。我该怎么做?

最佳答案

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

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

关于android - 将右引力设置为 ProgressDialog 内的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12320139/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com