android - Text input in SearchView doesn't show -


i noticed couple days ago inputting text in searchview doesn't show up. maybe problem started longer ago , hadn't noticed it, know working when first set search functionality.

here screenshot (i have entered text, , can see not showing):

enter image description here

i have tried change colour of text on searchview, this question, , i've tried changing text colour in searchable configuration xml file. after found none of these work, undid changes can see code have below:

mainactivity.java

@override public boolean oncreateoptionsmenu(menu) {       ...      // associate searchable configuration searchview     searchmanager searchmanager = (searchmanager) getsystemservice(search_service);     menuitem searchmenuitem = menu.finditem(r.id.action_search);     searchview searchview = (searchview) searchmenuitem.getactionview();     searchview.setsearchableinfo(searchmanager.getsearchableinfo(new componentname(this, searchresultsactivity.class)));     // note: getsearchableinfo(getcomponentname()) not work on flavours     // because of difference in app ids  } 

note i've used new componentname(...) instead of getsearchableinfo(getcomponentname()) since use different package names in different flavours.

the activity above searchview displayed. results shown in activity.

searchable.xml

<searchable xmlns:android="http://schemas.android.com/apk/res/android"     android:label="@string/app_name"     android:hint="@string/search_hint" /> 

androidmanifest.xml

    ...      <activity         android:name=".ui.mainactivity"         android:label="@string/title_activity_main"         android:theme="@style/apptheme">         <meta-data             android:name="android.app.default_searchable"             android:value=".searchresultsactivity" />     </activity>      ...      <activity         android:name=".ui.filter.searchresultsactivity"         android:label="@string/title_activity_search_results"         android:parentactivityname=".ui.mainactivity"         android:theme="@style/apptheme.search">         <meta-data             android:name="android.support.parent_activity"             android:value="com.companyname.appname.ui.mainactivity" />          <intent-filter>             <action android:name="android.intent.action.search" />         </intent-filter>          <meta-data             android:name="android.app.searchable"             android:resource="@xml/searchable" />     </activity>      ... 

styles.xml (the activity containing searchview uses apptheme.navdrawer)

...  <style name="base.apptheme" parent="theme.appcompat.light.noactionbar">     <item name="android:windownotitle">true</item>     <item name="windowactionbar">false</item>     <item name="colorbuttonnormal">?coloraccent</item> </style>  <style name="apptheme" parent="base.apptheme">     <item name="colorprimary">@color/theme_primary</item>     <item name="colorprimarydark">@color/theme_primary_dark</item>     <item name="coloraccent">@color/theme_accent</item> </style>  <style name="apptheme.navdrawer">     <item name="android:windowbackground">@color/window_background</item> </style>  ... 

v21/styles.xml

<style name="apptheme.navdrawer">     <item name="android:windowbackground">@color/window_background</item>     <item name="android:windowdrawssystembarbackgrounds">true</item>     <item name="android:statusbarcolor">@android:color/transparent</item> </style>  .... 

activity_main_filterable.xml (the layout activity uses)

<android.support.v4.widget.drawerlayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/drawerlayout"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true" >      <include layout="@layout/activity_main_content" />      <include layout="@layout/navdrawer"     android:id="@+id/navigationview" />      <include layout="@layout/filter_drawer"         android:id="@+id/filter_drawer" />  </android.support.v4.widget.drawerlayout> 

activity_main_content.xml

<relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:ads="http://schemas.android.com/apk/res-auto"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent">      <android.support.design.widget.coordinatorlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_above="@+id/adview">         <android.support.design.widget.appbarlayout             android:fitssystemwindows="true"             android:layout_width="match_parent"             android:layout_height="wrap_content" >             <android.support.v7.widget.toolbar                 android:id="@+id/toolbar"                 style="@style/apptheme.toolbar"                 android:layout_height="wrap_content"                 android:layout_width="match_parent"                 app:layout_scrollflags="scroll|enteralways"/>             <include layout="@layout/blank" /> <!-- prevent bugs -->         </android.support.design.widget.appbarlayout>          <include layout="@layout/fragment_misc_no_results"         android:id="@+id/fragment_no_results"/>          <android.support.v7.widget.recyclerview             android:id="@+id/recyclerview"             style="@style/apptheme.recyclerview.standardlist"             android:layout_width="match_parent"             android:layout_height="wrap_content"             app:layout_behavior="@string/appbar_scrolling_view_behavior" />     </android.support.design.widget.coordinatorlayout>      <com.google.android.gms.ads.adview         android:id="@+id/adview"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         ads:adsize="smart_banner"         ads:adunitid="@string/banner_ad_unit_id" /> </relativelayout> 

any ideas on might going on or how should solve it?

i had same issue, , me because had set toolbar height wrap_content. try giving size, this:

<android.support.v7.widget.toolbar     android:layout_width="match_parent"     android:layout_height="?attr/actionbarsize"     app:theme="@style/toolbartheme"     app:popuptheme="@style/apptheme.popupoverlay"     app:layout_scrollflags="scroll|enteralways"     /> 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

c# - Json.Net Serialize String from URI -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -