0

Just a simple problem without any idea of how to do it. Does anyone know how/if this can be done?

Reason: I just want one solid dialog box with no partitions as it looks a little better in my application.

EDIT

public void showCustomDialog() {
    Dialog dialog = new Dialog(this);

    dialog.setContentView(R.layout.customdialog);

    TextView thisText = (TextView) dialog.findViewById(R.id.customDialogThisText);
    thisText.setText("This");
    TextView thatText = (TextView) dialog.findViewById(R.id.customDialogThatText);
    thatText.setText("That");
    ImageView image = (ImageView) dialog.findViewById(R.id.customDialogImageView);
    image.setImageResource(R.drawable.icon);

    //Crashes the program with an AndroidRuntimeError
    //dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);

    dialog.show();
}

casperOne
  • 73,706
  • 19
  • 184
  • 253
NotACleverMan
  • 12,107
  • 12
  • 47
  • 67

2 Answers2

2

Just don't call setTitle() and there will be no title, like that:

alt text

LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
new AlertDialog.Builder(AlertDialogSamples.this)
    .setView(textEntryView)
    .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            /* User clicked OK so do some stuff */
        }
    })
    .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            /* User clicked cancel so do some stuff */
        }
    })
    .create();
Fedor
  • 43,261
  • 10
  • 79
  • 89
  • It just pops up with a blank title box then. Any other ideas? – NotACleverMan Oct 22 '10 at 13:55
  • 1
    Show us how you're calling your dialog box then. It shouldn't have a title section by default – Falmarri Oct 22 '10 at 17:29
  • Are you able to show any sample code for how you created the Dialog box shown? I have been using code from this post: http://stackoverflow.com/questions/2644134/android-how-to-create-a-dialog-without-a-title and I haven't been able to do it still. I'll edit my OP to show my code. – NotACleverMan Oct 25 '10 at 15:49
0

Just call dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE); before setting the view of the dialog by dialog.setContentView(R.layout.customdialog);

Juri
  • 1