Hello
Hello

Reputation: 119

EditText in dialog android

i have made a edittext in a dialog but i cant get to change the height.

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

Upvotes: 5

Views: 9992

Answers (2)

Kalyaganov Alexey
Kalyaganov Alexey

Reputation: 1771

I think it`s too late, but you can try this.

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);

Upvotes: 0

Yaqub Ahmad
Yaqub Ahmad

Reputation: 27659

You can use this:

edittext.setHeight(100);

Upvotes: 3

Related Questions