Change ImageView when Tab Focus changes

随声附和 提交于 2019-12-11 04:38:00

问题


I'm working with the LeftNavView Libary with Google TV, I have found that I can respond to events when a tab is selected or unselected, but I would like to change an ImageView outside of the tab when Focus has changed (i.e. when using the D-Pad to navigate, but not when it is necessarily selected).

The idea is to change an ImageView in another view when navigating around the tabs. Is there a way to easily do this that I'm not seeing?


回答1:


As there is no way to get the views used for the tabs, i think you will have to extend the LeftNavBarLibrary by implementing some methods either to set a View.OnFocusChangeListener to the ListItemViews (the LeftNavBar uses a ListView for the tabs) or to get the ListItemViews itself and then set the listener. See TabAdapter in TabDisplay.java for this. I did something similar to programmatically set a custom TabBackground by setting a RessourceId to the LeftNavBar, that passes it to the TabDisplay, that passes it to the TabAdapter.



来源:https://stackoverflow.com/questions/14168000/change-imageview-when-tab-focus-changes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!