Hint in Search Widget within Action Bar is not showing up
For some reason you need to put <action android:name="android.intent.action.SEARCH"/>
inside your tag. That's what fixed the problem for me.But be careful to put it in this order
<intent-filter> <action android:name="android.intent.action.SEARCH"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /></intent-filter>
otherwise your activity won't be recognized as launcher
No one has been able to answer my question yet...
I have found a way to change the hint value in the .java file but not in the .xml file.
Within the onCreateOptionsMenu(Menu menu)
method of MainActivity.java
, I can do:
searchView.setQueryHint("HINT TEXT...");
I believe I should still be able to preset a hint value of a SearchWidget in XML just like a simple EditText
.
Your have to provide a string resource for the hint attribute. Hardcoded text won't work. Instead of
android:hint="search"
use a string resource
android:hint="@string/search_hint"
The doc is clear about it: http://developer.android.com/guide/topics/search/searchable-config.html
android:hint="string resource"