I had the same problem, try to add this software:
searchView.setMaxWidth( Integer.MAX_VALUE );
If that does not work, try replacing the tag <item> to <SearchView>
If you use the API 20 or higher, do it
Add this to your styles.xml file:
/*Theme name and parent can be different - depends on the one that already declared in you manifest under the tag <application> theme:AppTheme*/ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> / <item name="searchViewStyle">@style/SearchView</item> </style> <style name="SearchView" parent="Widget.AppCompat.SearchView"> <item name="android:maxWidth">@dimen/maxSize</item> </style> <dimen name="maxSize">1000dp</dimen> different - depends on the one that already /*Theme name and parent can be different - depends on the one that already declared in you manifest under the tag <application> theme:AppTheme*/ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> / <item name="searchViewStyle">@style/SearchView</item> </style> <style name="SearchView" parent="Widget.AppCompat.SearchView"> <item name="android:maxWidth">@dimen/maxSize</item> </style> <dimen name="maxSize">1000dp</dimen> application> theme: AppTheme * / /*Theme name and parent can be different - depends on the one that already declared in you manifest under the tag <application> theme:AppTheme*/ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> / <item name="searchViewStyle">@style/SearchView</item> </style> <style name="SearchView" parent="Widget.AppCompat.SearchView"> <item name="android:maxWidth">@dimen/maxSize</item> </style> <dimen name="maxSize">1000dp</dimen> = "Theme.AppCompat.Light.DarkActionBar"> / /*Theme name and parent can be different - depends on the one that already declared in you manifest under the tag <application> theme:AppTheme*/ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> / <item name="searchViewStyle">@style/SearchView</item> </style> <style name="SearchView" parent="Widget.AppCompat.SearchView"> <item name="android:maxWidth">@dimen/maxSize</item> </style> <dimen name="maxSize">1000dp</dimen> "> @ dimen / maxSize </ item> /*Theme name and parent can be different - depends on the one that already declared in you manifest under the tag <application> theme:AppTheme*/ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> / <item name="searchViewStyle">@style/SearchView</item> </style> <style name="SearchView" parent="Widget.AppCompat.SearchView"> <item name="android:maxWidth">@dimen/maxSize</item> </style> <dimen name="maxSize">1000dp</dimen>
source share