5

tôi đã tạo một văn bản trong hộp thoại nhưng tôi không thể thay đổi chiều cao.EditText trong hộp thoại android

AlertDialog.Builder editalert = new AlertDialog.Builder(this); 

editalert.setTitle("messagetitle"); 
editalert.setMessage("here is the message"); 


final EditText input = new EditText(this); 
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
     LinearLayout.LayoutParams.FILL_PARENT, 
     LinearLayout.LayoutParams.FILL_PARENT); 
input.setLayoutParams(lp); 
editalert.setView(input); 

editalert.setPositiveButton("Send via email", new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, int whichButton) { 


    } 
}); 


editalert.show(); 

Trả lời

3

Bạn có thể sử dụng này:

edittext.setHeight(100); 
+0

không hoạt động ... Cung cấp cho tôi lỗi – Si8

0

Tôi nghĩ rằng nó `s quá muộn, nhưng bạn có thể thử loại này.

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.MATCH_PARENT, 
        LinearLayout.LayoutParams.WRAP_CONTENT); 
Các vấn đề liên quan