0
如果在java控制台中很容易就使用printf,但是我对android很陌生,如何创建列来对齐对话框中的字符串?在android对话框中格式化
例如:
public void onAlert() {
new AlertDialog.Builder(MainActivity.this)
.setTitle("Completed! Workout log: ")
.setMessage("Date: " + date + "\n" +
"Item : " + item + "\n" +
"Price: " + price + "\n" +
"Value: " + value + "\n")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
})
.show();
我想实现这一点:
谢谢!我可以问一个新手问题吗? setView有什么作用? –
(我发布的链接的第一行),“将[布局]添加到AlertDialog” – njzk2