rubensousa / DpadRecyclerView

A RecyclerView built for Android TV with Compose in mind and as a replacement for Leanback's BaseGridView.
https://rubensousa.github.io/DpadRecyclerView/
Apache License 2.0
136 stars 17 forks source link

I don't get focus I don't know why. can anyone help me to solve this #157

Closed pavelsust closed 1 year ago

pavelsust commented 1 year ago

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" android:layout_gravity="right" android:clipChildren="false">

<com.rubensousa.dpadrecyclerview.DpadRecyclerView
    android:id="@+id/slider_recyclerView"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="match_parent"
    android:clipChildren="false" />

</androidx.constraintlayout.widget.ConstraintLayout>

binding.sliderRecyclerView.requestFocus()
binding.sliderRecyclerView.adapter = bannerAdapter
rubensousa commented 1 year ago

Please try following this guide: https://rubensousa.github.io/DpadRecyclerView/selection/

You need a focusable element in your adapter

rubensousa commented 1 year ago

@pavelsust did you manage to solve this problem?