把一个edittext放在线性布局文件最下方
时间: 2024-01-21 10:04:31 浏览: 66
可以使用 android:layout_weight 属性和一个空的 View 来将 EditText 放在线性布局文件的最下方。
具体步骤如下:
1. 在布局文件中添加一个空的 View,并将其设置为权重为 1。
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
...
</LinearLayout>
```
2. 在上面的 View 下方添加 EditText,并设置其高度为 wrap_content。
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入内容"/>
</LinearLayout>
```
这样,EditText 就会被放置在线性布局文件的最下方了。
阅读全文
相关推荐
















