由网友(海是一座无墙的城)分享简介:我想在我的对话框中的消息文本为中心对齐。I want the message text within my dialog box to be center aligned.推荐答案创建自己的TextView的对象,然后将其提供给弹出建设者查看:Create your own TextView object an...
我想在我的对话框中的消息文本为中心对齐。
I want the message text within my dialog box to be center aligned.
推荐答案
创建自己的TextView的对象,然后将其提供给弹出建设者查看:
Create your own TextView object and then supply it to popup builder as View:
AlertDialog.Builder popupBuilder = new AlertDialog.Builder(this);
TextView myMsg = new TextView(this);
myMsg.setText("Central");
myMsg.setGravity(Gravity.CENTER_HORIZONTAL);
popupBuilder.setView(myMsg);
您可以控制所有其它的文本参数(款式,颜色,大小...)。要控制利润率可能会编程方式创建的LinearLayout,设置的LayoutParams,然后把TextView的内容。
You can control all other text parameters (style, color, size ...). To control margins you may programatically create LinearLayout, set LayoutParams, and then put TextView into it.
相关推荐
最新文章