有关如何更改建议框样式的任何想法?我定位的是sdk 16版。
我尝试使用suggestionRowLayout项目为searchview定义样式(参考:android-developers.blogspot.be/2014/10/appcompat-v21-material-design-for-pre.html),但它没有效果。
<style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView">
<item name="suggestionRowLayout">@layout/search_suggestion_row</item>
</style>
图像: http://s22.postimg.org/p353knca9/suggestions.jpg
图片onClick行:http://s18.postimg.org/5w0fuf0o9/seard.jpg
有用信息
compileSdkVersion 22
buildToolsVersion&#34; 21.1.2&#34;
依赖关系
com.android.support:appcompat-v7:22.0.0
com.android.support:support-v4:22.0.0
应用主题
Theme.AppCompat.Light.DarkActionBar
答案 0 :(得分:0)
只需更改您可能在建议游标适配器中的newView()
方法上充气的xml建议中的视图属性。
答案 1 :(得分:0)
我使用的是android.Widget.SearchView而不是 android.support.v7.widget.SearchView
menu.xml
app:actionViewClass="android.Widget.SearchView"
应该是
应用程式:actionViewClass = “的 android.support.v7.widget.SearchView 强>”
在我的Fragment类中我导入了错误的包。