1

私のプロジェクトでは、AlertDialog の代わりにカスタム ダイアログを使用する必要があります。しかし、Dialog スタイルには 2 つの問題があります。

  1. 幅が狭すぎる
  2. タイトルスペースを削除できません

だから、私は必要です

ここに画像の説明を入力

しかし、得る:

ここに画像の説明を入力

呼び出しコード:

Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.write_message);
dialog.show();

レイアウト XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    <EditText
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textMultiLine"
        android:minLines="3" >

        <requestFocus />
    </EditText>


    <Button
        android:id="@+id/send_message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/send_message" />

</LinearLayout>

この問題を解決するにはどうすればよいですか? 助けてください。

4

1 に答える 1

2

やってみました :

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //for the title space

dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); //for the width

必要に応じて、レイアウト xml にパディングを追加できます

?

于 2012-10-30T14:19:06.123 に答える