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