Reputation: 319
If in java console it's easy just use printf, but I'm new to android, how to create column to align those strings inside the dialog?
example :
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();
I would like to achieve this :
Upvotes: 0
Views: 1268
Reputation: 39406
Option A (dirty) : get the alert text view and set a fixed size font
Option B (clean) : use a custom view and a tablelayout (see http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout )
Upvotes: 1