I want to have a dialog containing 3 views 1. title with black background 2. some body text white background 3. a line with 2 buttons with gray background.
The problem is that i want the background color of the body to be WHITE, but even my view has set backgroundcolor to WHITE, there seems to be some margins at top and bottom of the body that got a diffrent background color.
TextView title = new TextView(this);
title.setText("This is my title");
title.setBackgroundColor(Color.BLACK);
title.setPadding(10, 10, 10,10);
title.setGravity(Gravity.CENTER);
title.setTextColor(Color.WHITE);
title.setTextSize(20);
TextView view = new TextView(this);
view.setText("Lorem Ipsum blabla bla \n more bla bla aha hhahah blablalblal.");
view.setBackgroundColor(Color.WHITE);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setCustomTitle(title);
builder.setView(view);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Bingo.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
((View)view.getParent()).setBackgroundColor(Color.WHITE); // <-- UGLY fix to avoid stupid margins at top and bottom of the body...
Any ideas how i can remove the last line of the code the "UGLY fix" ?