在android搜索视图中隐藏关闭按钮 [英] Hide close button in android Search View
本文介绍了在android搜索视图中隐藏关闭按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经实现了一个android搜索视图.当搜索视图获得焦点时,右侧的关闭按钮[x]就会出现.如何在android搜索视图中隐藏关闭按钮
I have implemented an android search view.When the search view gains focus, the close button [x] at the right shows up.How to hide close button in android search view
推荐答案
像这样改变你的主题:
对于 <v21:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarWidgetTheme">@style/AppTheme.WidgetTheme</item>
</style>
<style name="AppTheme.WidgetTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="searchViewCloseIcon">@android:color/transparent</item>
</style>
对于 v21 及更高版本:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="searchViewStyle">@style/AppTheme.SearchView</item>
</style>
<style name="AppTheme.SearchView" parent="Widget.AppCompat.SearchView">
<item name="closeIcon">@android:color/transparent</item>
</style>
另请查看此以获得更多自定义.
Also check this for more customization.
这篇关于在android搜索视图中隐藏关闭按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文