设置文本框的大小与wrapcontent
问题描述:
这是我的布局设置文本框的大小与wrapcontent
<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>
的一部分,这是它的样子
图像的点是我想要的文本框为了更大,我使用wrap_parent值来设置高度,我期望文本框足够大,但不是那样,文本框就像你看到的那样不知何故裁剪过,我不知道为什么,任何帮助,建议,任何东西?,我不想设定固定价值为文本框
答
您按钮被限制高度,所以要么你可以使按钮的layout_hieght匹配,父母或如果看起来很奇怪,投入的LinearLayout按钮,使新的LinearLayout的高度match_parent
但我认为最好的办法是使用一个RelativeLayout并具有相同布局的所有3个视图
答
的高度,在“添加到黑名单”按钮ES,改变layout_height为“FILL_PARENT”
该按钮使的EditText小,因为他们的底线是一字排开
您是否尝试过使用线性布局中的layout_weight值? – 2012-01-09 16:26:58