如果在 java 控制台中使用 printf 很容易,但我是 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();
我想实现这一点: