如何在Android的对话框窗口中使用Autocompletetext视图

如何在Android的对话框窗口中使用Autocompletetext视图,android,android-dialog,android-2.2-froyo,Android,Android Dialog,Android 2.2 Froyo,在我的应用程序中,我希望在对话框窗口中显示autocompletetext视图,如果运行我的应用程序,我无法从MainActivity显示对话框窗口。有人能帮我吗 MainActivity.java CityListDialog.java 我不明白 所以为了解决这个问题,我认为你必须这样做 CityListDialog obj=new CityListDialog(context, COUNTRIES); obj.show(); 我不明白 所以为了解决这个问题,我认为你必须这样做 CityLi

在我的应用程序中,我希望在对话框窗口中显示autocompletetext视图,如果运行我的应用程序,我无法从MainActivity显示对话框窗口。有人能帮我吗

MainActivity.java CityListDialog.java 我不明白

所以为了解决这个问题,我认为你必须这样做

CityListDialog obj=new CityListDialog(context, COUNTRIES);
obj.show();
我不明白

所以为了解决这个问题,我认为你必须这样做

CityListDialog obj=new CityListDialog(context, COUNTRIES);
obj.show();
替换citylistview.xml代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <AutoCompleteTextView
        android:id="@+id/EditBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
 >
 </AutoCompleteTextView>
        <ListView
            android:id="@+id/List"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        </ListView>

</LinearLayout>
替换citylistview.xml代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <AutoCompleteTextView
        android:id="@+id/EditBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
 >
 </AutoCompleteTextView>
        <ListView
            android:id="@+id/List"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        </ListView>

</LinearLayout>

你用过dialog.show吗?我不知道在showSearch onclick listener use obj.show中在哪里使用show;我在Dialog.show中出错;你用过dialog.show吗?我不知道在showSearch onclick listener use obj.show中在哪里使用show;我在Dialog.show中出错;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <AutoCompleteTextView
        android:id="@+id/EditBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
 >
 </AutoCompleteTextView>
        <ListView
            android:id="@+id/List"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        </ListView>

</LinearLayout>