这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical">

    <ListView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@android:id/list" />
    <EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/search" android:hint="Filter results" />

是什么原因导致我的ListView隐藏了我的编辑文本?

最佳答案

也许试着做:

<ListView
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_width="fill_parent" android:id="@android:id/list"/>
<EditText
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:id="@+id/search"
    android:hint="Filter results"/>

这样,您的ListView将增长到只填充未使用的空间,而不考虑其自身的内容需求。

关于android - EditText现在显示在ListView下,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5319965/

10-12 00:19
查看更多