set the size of textbox with wrapcontent

865 views Asked by At

This is the part from my layout

    <LinearLayout android:orientation="vertical"
        android:layout_height="wrap_content" android:layout_below="@id/checkBox_block_all"
        android:id="@+id/linearLayout_addtoblack" android:layout_width="fill_parent">
        <LinearLayout android:id="@+id/linearLayout2"
            android:layout_width="match_parent" android:layout_height="wrap_content"
            android:gravity="center">
            <LinearLayout android:id="@+id/linearLayout3"
                android:layout_width="wrap_content" android:layout_height="match_parent"
                android:orientation="vertical" android:layout_weight="1">
                <TextView android:id="@+id/textView1"
                    android:layout_height="wrap_content" android:text="Enter the full number"
                    android:layout_width="fill_parent"></TextView>
                <EditText android:layout_width="match_parent"
                    android:layout_height="wrap_content" android:id="@+id/editText1"
                    android:textSize="18sp">
                    <requestFocus></requestFocus>
                </EditText>
            </LinearLayout>
            <Button android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:id="@+id/button_add"
                android:text="Add to black list" android:layout_weight="1"></Button>
        </LinearLayout>
    </LinearLayout>

and this is the image of how it looks like

enter image description here

The point is I want the textbox to be bigger, I set the height with value wrap_parent and I expect that the textbox will be big enough , but is not like that, the textbox as you can see is somehow cropped and I do not know why, any help , advice , anything ?, the point I do not want to set fixed values for the height of the textbox

2

There are 2 answers

0
nandeesh On BEST ANSWER

your Button is limiting the height, so either you could make layout_hieght of button to match-parent or if that looks odd, put the button in linearlayout and make the new linearlayout's height as match_parent

But I think the best way would be using a RelativeLayout and having all 3 views in the same layout

0
Matt Harris On

In the "Add to black list" button, change the layout_height to "fill_parent"

The button is making the edittext smaller because their baseline is lined up