Android TV-Creating TV Navigation
TV devices provide a limited set of navigation controls for apps. Creating an effective navigation scheme for your TV app depends on understanding these limited controls and the limits of users' perception while operating your app. As you build your Android app for TVs, pay special attention to how the user actually navigates around your app when using remote control buttons instead of a touch screen.
This type of control limits movement to up, down, left, and right. To build a great TV-optimized
app, you must provide a navigation scheme where the user can quickly learn how to navigate your app using these limited controls.
The Android framework handles directional navigation between layout elements automatically, so you typically do not need to do anything extra for your app. However, you should thoroughly test navigation with a D-pad controller to discover any navigation problems. Follow these guidelines to test that your app's navigation system works well with a D-pad on a TV device:
- Ensure that a user with a D-pad controller can navigate to all visible controls on the screen.
- For scrolling lists with focus, make sure that the D-pad up and down keys scroll the list, and the Enter key selects an item in the list. Verify that users can select an element in the list and that the list still scrolls when an element is selected.
- Ensure that switching between controls between controls is straightforward and predictable.
<TextView android:id="@+id/Category1" android:nextFocusDown="@+id/Category2"\>
Attribute | Function |
---|---|
nextFocusDown |
Defines the next view to receive focus when the user navigates down. |
nextFocusLeft |
Defines the next view to receive focus when the user navigates left. |
nextFocusRight |
Defines the next view to receive focus when the user navigates right. |
nextFocusUp |
Defines the next view to receive focus when the user navigates up. |
Android provides Drawable State List Resources to implement highlights for focused and selected controls. The following code example demonstrates how to enable visual behavior for a button to indicate that a user has navigated to the control and then selected it:
<!-- res/drawable/button.xml --> <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_pressed" /> <!-- pressed --> <item android:state_focused="true" android:drawable="@drawable/button_focused" /> <!-- focused --> <item android:state_hovered="true" android:drawable="@drawable/button_focused" /> <!-- hovered --> <item android:drawable="@drawable/button_normal" /> <!-- default --> </selector>
相關文章
- Android TV開發——RecyclerView For TVAndroidView
- Android TVAndroid
- Android TV-Building Layouts for TVAndroidUI
- android tv-Building TV GamesAndroidUIGAM
- android tv-TV Apps ChecklistAndroidAPP
- android TV-Building TV Channels,Developing a TV Input ServiceAndroidUIdev
- Android TV-Handling TV HardwareAndroid
- android TV-Recommending TV Content,Android
- Android TV-Building TV Apps,Get Started with TV AppsAndroidUIAPP
- Android Jetpack Navigation基本使用AndroidJetpackNavigation
- android TV-Making TV Apps Searchable,Searching within TV AppsAndroidAPP
- Android 官方元件 Navigation 初使用Android元件Navigation
- android-Providing Up Navigation,Providing Proper Back NavigationAndroidNavigation
- Android Jetpack 架構元件之 NavigationAndroidJetpack架構元件Navigation
- android-Creating a Navigation DrawerAndroidNavigation
- Android Jetpack - Android TV 應用開發教程AndroidJetpack
- Android TV開發總結【RecycleView】AndroidView
- android TV-Working with Channel DataAndroid
- android tv-Managing User InteractionAndroid
- Android Jetpack Navigation 深入體驗報告AndroidJetpackNavigation
- 一起看 I/O | Google TV 和 Android TV OS 的最新進展GoAndroid
- stf 怎麼使用在 android tv 上Android
- Android TV版小米盒子專版亮相Android
- Android TV端RecyclerView焦點亂跑AndroidView
- Android Jetpack - 使用 Navigation 管理頁面跳轉AndroidJetpackNavigation
- Android Jetpack 之Navigation Architecture Component使用AndroidJetpackNavigation
- android-Implementing Descendant Navigation,Notifying the UserAndroidNavigation
- [譯]利用 Android 構建 TV 的未來Android
- [譯] 利用 Android 構建 TV 的未來Android
- [譯]SearchFragment --Android TV 開發手冊十二FragmentAndroid
- Android官方架構元件Navigation:大巧不工的Fragment管理框架Android架構元件NavigationFragment框架
- 聊聊真實的 Android TV 開發技術棧Android
- android-Designing Effective Navigation,Planning Screens and Their RelationshipsAndroidNavigation
- android-Implementing Effective Navigation,Creating Swipe Views with TabsAndroidNavigationView
- android-Building a Notification,Preserving Navigation when Starting an ActivityAndroidUINavigation
- ABAP webdynpro的view navigation和WebUI的view navigationWebViewNavigationUI
- 如何在Android TV 桌面新增自定義頻道/節目Android
- 小米和Google合作:Android TV版小米盒子進軍美國GoAndroid