Reputation: 3851
Can I enter two text rows as the Android dialog heading. If so, how can I do that? I tried as,
AlertDialog.Builder builder=new AlertDialog.Builder(Login.this,android.R.style.Theme_Holo_Dialog).setTitle(Heading)
and set the title using new line character as below.
Heading="raw 1 \n raw 2";
but it's not working and just show the "\n" in the heading. How can I do this?
Upvotes: 3
Views: 103
Reputation: 590
Use string to declare : <string name="text">row1\nrow2</string>
builder.setTitle(getString(R.string.text));
Upvotes: 0
Reputation: 7177
Use Html.fromHtml() method to show html content on TextView
EX:
String Heading="raw 1 \n raw 2";
textView.setText(Html.fromHtml(Heading));
dialogBuilder.setCustomTitle(textView);
Upvotes: 0
Reputation: 6533
builder.setTitle("raw 1 \n raw 2");
And onother Solution i s
TextView textView = new TextView(context);
textView.setText("raw 1 \n raw "2);
dialogBuilder.setCustomTitle(textView);
Upvotes: 2