【发布时间】:2015-12-18 15:19:11
【问题描述】:
我有这个LinearLayout 包含一个ListView 和一个LinearLayout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<EditText
android:layout_width="fill_parent"
android:layout_height="40dp"
android:hint="Hej"/>
</LinearLayout>
</LinearLayout>
ListView 占据整个布局,带有EditText 的LinearLayout 被添加到屏幕底部边缘下方并且不可见。我怎样才能解决这个问题?我尝试了layout_weight,但没有成功。
【问题讨论】:
-
顺便说一下,
match_parent和fill_parent做同样的事情。无需同时使用它们。事实上,您应该只使用match_parent,因为fill_parent在 API 8 中已被弃用。 -
@NoChinDeluxe 感谢您的澄清,我认为它们是不同的。
标签: android android-layout android-listview android-linearlayout