如何为RecyclerView支持dpad控件 [英] How to support dpad controls for RecyclerView

查看:144
本文介绍了如何为RecyclerView支持dpad控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将Android移动应用移植到Android TV.我的RecyclerView似乎在我的Android TV应用中正确显示.我在RecyclerView中使用linearLayout.但是我似乎无法使用dpad控件在RecyclerView中导航.

I am currently trying to port Android mobile app to Android TV. I have a RecyclerView that seems to be displaying correctly in my Android TV app. I am using linearLayout for my RecyclerView. But I don't seem to be able to navigate inside RecyclerView using dpad controls.

有什么想法吗?

这是有关的xml:

<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/RecyclerView"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:background="@color/nav_bg"
    android:scrollbars="vertical"
    tools:showIn="@layout/activity_content" />

推荐答案

对项目布局进行根视图android:focusable="true"

Make root view of your item layout android:focusable="true"

这篇关于如何为RecyclerView支持dpad控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆