Android ArrayAdapter文本过滤在抽屉布局中中断
我有一种不幸的感觉,这仅仅是Android的一个bug,因为抽屉布局仍然相对较新 基本上我有一个ListView,上面有一个ArrayAdapter。我以前在执行textfilter搜索时没有遇到任何问题。但后来我决定在布局中实现抽屉布局。一旦添加抽屉,文本过滤就会中断 在此之前,软件键盘将弹出,您将开始键入(您的键入覆盖在屏幕上),列表将按该字符串过滤 在抽屉布局中,键盘会弹出,但在键入内容时不会发生任何事情 我肯定抽屉布局是造成这种情况的原因,因为我一删除布局代码,搜索功能就又开始工作了 以下是我的XML供参考:Android ArrayAdapter文本过滤在抽屉布局中中断,android,android-listview,android-arrayadapter,drawerlayout,Android,Android Listview,Android Arrayadapter,Drawerlayout,我有一种不幸的感觉,这仅仅是Android的一个bug,因为抽屉布局仍然相对较新 基本上我有一个ListView,上面有一个ArrayAdapter。我以前在执行textfilter搜索时没有遇到任何问题。但后来我决定在布局中实现抽屉布局。一旦添加抽屉,文本过滤就会中断 在此之前,软件键盘将弹出,您将开始键入(您的键入覆盖在屏幕上),列表将按该字符串过滤 在抽屉布局中,键盘会弹出,但在键入内容时不会发生任何事情 我肯定抽屉布局是造成这种情况的原因,因为我一删除布局代码,搜索功能就又开始工作了 以
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/header_container">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:gravity="center_vertical"
android:id="@+id/header_text" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/header_text"
android:layout_alignBottom="@id/header_text"
android:layout_alignParentRight="true"
android:id="@+id/searchbutton"
android:background="@android:color/transparent"
android:src="@drawable/ic_menu_search"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/header_text"
android:layout_toLeftOf="@id/searchbutton"
android:layout_alignParentTop="true"
android:gravity="center"
android:visibility="visible"
android:id="@+id/headerClassField"/>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/header_text"
android:fastScrollEnabled="true"
android:id="@+id/spell_list_view" />
</RelativeLayout>
<include layout="@layout/drawer_spell_list"/>
</android.support.v4.widget.DrawerLayout>
以及包含的抽屉代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="240dp"
android:layout_gravity="left"
android:background="@color/midnight_blue"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="3dp"
android:orientation="horizontal">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/star"/>
<TextView
android:id="@+id/drawer_metamagic_link"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:textSize="16sp"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:text="@string/drawer_metamagic"/>
</LinearLayout>
<LinearLayout
style="@style/drawer_border"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="3dp"
android:orientation="horizontal">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/inward_arrows"/>
<TextView
android:id="@+id/drawer_longclick_link"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:textSize="16sp"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:text="@string/drawer_longclick"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="32sp"
android:text="..."/>
<include layout="@layout/drawer_main"/>
</LinearLayout>
抽屉可以完美地工作,但如果包含抽屉,则搜索无法完成。任何帮助都将不胜感激
编辑:有趣的是,如果我使用滑动面板布局而不是抽屉布局,过滤器不会中断。这可能是我的解决办法。我也有抽屉布局的问题。我将内部视图切换为片段,现在隐藏视图不再向外滑动。我的问题不是设置布局重力。与你的问题无关。