gpt4 book ai didi

安卓 : how to align message in alertDialog?

转载 作者:IT老高 更新时间:2023-10-28 21:56:44 26 4
gpt4 key购买 nike

我必须在 android alertdialog 中按中间对齐文本。但我找不到路...有人知道怎么做吗?

最佳答案

试试这个

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("My Title");
builder.setMessage("your message");
builder.setPositiveButton("OK", null);
AlertDialog dialog = builder.show();
TextView messageText = (TextView)dialog.findViewById(android.R.id.message);
messageText.setGravity(Gravity.CENTER);
dialog.show();

关于安卓 : how to align message in alertDialog?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3965122/

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