2012-04-01 12 views
1

私のダイアログレイアウトが含まれていますなぜfill_parentがダイアログに適用されないのですか?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical"> 

ダイアログは、まだその内容と小さく表示されます。

私がしなければならなかった:

dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); 

... onCreateDialogコールバックの中にそれが画面を埋めるために。

googleの開発サイトでこの現象の参照を見つけることができません。

+0

完全なxmlファイルを共有できますか – Ishu

答えて

1

多くの実験を経て自分の質問に答える。問題は、AlertDialogではなくDialogクラスの使用に関係しています。

要するに、適切なツールとアプローチを使用していないため、機能しませんでした。ダイアログクラスを使用し続けるが、その後d.getWindow()を使用し、そこから寸法を変更またはAlertDialogを使用するように、そのようなレイアウトを膨張させることによってそれを強制:

LayoutInflater inflater = (LayoutInflater) getLayoutInflater(); 
View layout = inflater.inflate(R.layout.about, null); 
AlertDialog.Builder builder = new AlertDialog.Builder(this); 

この連結は助けた溶液のいずれかでしたロット:Why does LayoutInflater ignore the layout_width and layout_height layout parameters I've specified?

関連する問題