这个问题还是比较适合通过weight处理。
@张炎Lior的大体思路是正确的,如果你仅仅想让输入框那一行在下面,并且宽度随意增加,或者仅仅想让按钮显示出来,那么就不要设置weight比例,直接就是1:0就好了,具体代码见下面:权重值越小越先渲染
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TextView android:text="welcome"
- android:id="@+id/TextView"
- android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
- </TextView>
- <LinearLayout android:id="@+id/LinearLayout"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0">
- <EditText android:id="@+id/EditText"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1">
- </EditText>
- <Button android:text="label_submit_button"
- android:id="@+id/Button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0">
- </Button>
- </LinearLayout>
- </LinearLayout>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。