简体   繁体   English

Android TV App中搜索球旁边的图标

[英]Icon Next to the Search Orb in Android TV App

How can I add an icon next to the search orb, just as displayed below? 如何在搜索框旁边添加图标,如下所示? I'd like to display a login page when the user clicks on the icon. 当用户单击图标时,我想显示一个登录页面。

在此处输入图片说明

You can't, if you want to use the standard widgets offered by the Leanback library, such as BrowseFragment . 如果要使用Leanback库提供的标准小部件(例如BrowseFragment

There is a way of creating your own version of the BrowseFragment widget, so that it is fully customizable and you can add as many buttons as you like, but it is definitely not easy to do. 有一种方法可以创建您自己的BrowseFragment小部件版本,以便可以完全自定义它,并且可以添加任意数量的按钮,但这绝对不容易。 I've written a series of posts on this subject, which you can find here: 我已经写了一系列关于这个主题的文章,您可以在这里找到:

Building for Android TV Android TV版

There is also a demo project that already gives you a starting point for the custom interface. 还有一个演示项目已经为您提供了自定义界面的起点。 The code can be found on this GitHub repo ( episode_4 is probably what you're looking for). 可以在此GitHub存储库上找到代码( episode_4可能就是您想要的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM