我有一个包含ListView
和LinearLayout
的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