0

やり方が全くわからない単純な問題。これができるかどうか/方法を知っている人はいますか?

理由:私のアプリケーションでは見た目が少し良くなるので、パーティションのない 1 つのソリッドなダイアログ ボックスが必要です。

編集

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();
}

4

2 に答える 2

2

setTitle() を呼び出さないでください。次のように、タイトルはありません。

代替テキスト

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();
于 2010-10-22T13:49:51.250 に答える
0

dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE); を呼び出すだけです。dialog.setContentView(R.layout.customdialog); によってダイアログのビューを設定する前に。

于 2010-11-03T16:07:21.110 に答える