android - Weird gray popup with text when typing in SearchView -


i have searchview in app , when type in it, every character shows in weird popup can seen below.

example

layout:

<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"     android:focusable="true"     android:focusableintouchmode="true"     android:background="@color/white"     tools:context="com.example.myapp">      <searchview         android:id="@+id/search_view"         android:queryhint="@string/select_story_query_hint"         android:layout_width="match_parent"         android:layout_height="wrap_content" />      <listview         android:id="@+id/list_view"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="1"         android:divider="@color/gray"         android:dividerheight="1dp"/>      <button         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="@string/create_new_story_button"         android:id="@+id/createstorybutton"         android:layout_gravity="center_horizontal"         android:layout_margin="10dp"         android:layout_marginbottom="5dp"         android:paddingleft="20dp"         android:paddingright="20dp"         android:background="@drawable/low_priority_button_background"         android:textcolor="@color/black" />      <button         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="@string/done"         android:id="@+id/select_story_done"         android:layout_gravity="center_horizontal"         android:layout_margin="10dp"         android:layout_margintop="5dp"         android:paddingleft="20dp"         android:paddingright="20dp"         android:background="@drawable/button_background"         android:textcolor="@color/white" /> </linearlayout> 

code:

msearchview = (searchview) view.findviewbyid(r.id.search_view); msearchview.seticonifiedbydefault(false); msearchview.setonquerytextlistener(this); msearchview.setsubmitbuttonenabled(false); msearchview.setqueryhint(getstring(r.string.query_hint)); 

listener:

@override public boolean onquerytextchange(string newtext) {     if (textutils.isempty(newtext)) {         mlistview.cleartextfilter();     } else {         mlistview.setfiltertext(newtext);     }     return true; } 

i can't seem find issue when search (guess not using correct keywords). happening on multiple devices running different versions of android (n5 5.1, o+o 4.4) , particular field has issue, other edittext fields have no issue.

this has built in functionality of listview's filter functionality. jonascz pointed out, how solve can found here. code changes onquerytextchange() method fix (basically use adapter's filter functionality):

    @override     public boolean onquerytextchange(string newtext) {         filter filter = adapter.getfilter();         if (textutils.isempty(newtext)) {             filter.filter("");         } else {             filter.filter(newtext);         }         return true;     } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -