-1

好吧,我整天都在尝试这个,但我找不到错误,我陷入了死胡同。我有一个 xml 文件,我有一个 listview 和我的列表,我想要一个 AutoCompleteTextView,稍后我将用作搜索栏。问题是在我的 xml 文件中,一切似乎都很好,并且同时出现 listview 和 AutoCompleteTextView 但是当我在模拟器中运行我的应用程序只打印列表视图。我尝试使用 editText 而不是自动完成,但再次没有发生任何事情。这是我的 xml 文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".sqlviewpatients" >

<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <AutoCompleteTextView
        android:id="@+id/autoCompleteTextView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_weight="1"
        android:ems="10"
        android:text="AutoCompleteTextView" />



</RelativeLayout>

<ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/relativeLayout1" >

</ListView>

</RelativeLayout>

请告诉我我做错了什么?我不知道我还能做什么

4

1 回答 1

0

好的,我发现了错误!!!!在 .java 文件中,我让我的类扩展了 List Activity 并且我在评论中评论了 setContentView(R.layout.something) 是错误的,setContent 不应该是评论!我花了 2 天的时间才找到它,所以我希望这个答案对其他人有帮助

于 2013-05-29T10:35:55.490 回答