I currently have a SearchView
in my app's ActionBar
(of which I am populating from an XML layout file) and I am trying to force it to only take numeric input. I've tried setting the android:inputType="number"
attribute in XML, but it has no effect.
Does anyone know the source of this problem?
The XML menu resource:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/search"
android:title="@string/menu_search"
android:actionViewClass="android.widget.SearchView"
android:icon="@drawable/ic_menu_search_holo_light"
android:inputType="number" />
</menu>
setInputType on a searchView was introduced in API 14. To set it to number try :
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With