2012-07-22 50 views
0

我想從對話框調用者alert1收集用戶輸入。如何使UI控件在對話框中正確顯示

AlertDialog.Builder alert1=new AlertDialog.Builder(context); 
LinearLayout layout1=new LinearLayout(context);//context is an object of type Context previously initialised to 'this' 
layout1.addView(box1);//box1 is an EditText 
alert1.setView(layout1); 
alert1.show(); 

然而,這使得EditText上出現reallys小。但如果我這樣做,而不是

alert1.setView(box1); 

和擺脫的LinearLayout的一起看起來正確的,但我不能添加了自定義UI控件來此警告框。誰能告訴我在哪裏,我錯了

其目標的Android 4.0

也是我想兩個方向的線性佈局..

+0

你能告訴我們你的佈局文件嗎? – JuSchz 2012-07-22 13:06:57

+0

可以添加快照 – Ronnie 2012-07-22 13:09:04

回答

0

嘗試設置LayoutParamsLinearLayout用下面的代碼linearLayout.setLayoutParams(params);