对于 Leanback BrowseFragment
,默认情况下屏幕左侧有一个搜索 View 。是否可以更改 SearchOrbView
的默认图标或隐藏它。
https://cdn-images-1.medium.com/max/800/1*oIFbcdjYrIqxU55-B23tjA.gif
最佳答案
如 developer.android.com 上的文档所述如果您不调用 setOnSearchClickedListener
,搜索球将不可见:
public void setOnSearchClickedListener (View.OnClickListener listener)
Sets a click listener for the search affordance.
The presence of a listener will change the visibility of the search affordance in the fragment title. When set to non-null, the title will contain an element that a user may click to begin a search.
如果您想要更改 SearchOrbView
的图标,您可以编辑您的样式:
<style name="Theme.Example.Leanback" parent="Theme.Leanback">
<item name="searchOrbViewStyle">@style/CustomSearchOrbView</item>
</style>
<style name="CustomSearchOrbView" parent="Widget.Leanback.SearchOrbViewStyle">
<item name="searchOrbIcon">@drawable/your_search_orb_icon</item>
</style>
关于android - 更改 Android TV 应用程序 BrowseFragment 的 SearchView 默认图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33173143/