Dpad control on horizontal recyclerview
<p>I am making app for <code>android TV</code>. I need a horizontal <code>Recyclerview</code> that scroll with <code>DPAD</code> controller to select item of <code>Recyclerview</code>with <code>DPAD</code> right key and <code>DPAD</code> left key when <code>Recyclerview</code> get focus. But it does not work. Below is my code</p>

<p>Activity Code</p>

<pre><code>    public class Main2Activity extends AppCompatActivity {
    String A[]= {"A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
            "E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E","E"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.recylcer_row);
        RecyclerView recyclerView = (RecyclerView)findViewById(R.id.innerRview);
        InnerAdapter innerAdapter = new InnerAdapter(this,A);
        recyclerView.requestFocus();
        recyclerView.setAdapter(innerAdapter);
    }
}
</code></pre>

<p>Adapter code</p>

<pre><code>public class InnerAdapter extends RecyclerView.Adapter&lt;InnerAdapter.MyViewHolder&gt; {
    Context context;
    String arrayList[];

    public InnerAdapter(Context context, String[] arrayList) {
        this.context = context;
        this.arrayList = arrayList;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.inner_row, parent, false);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        holder.textView.setText(arrayList[position]);

    }

    @Override
    public int getItemCount() {
        return arrayList.length;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView textView;

        public MyViewHolder(View itemView) {
            super(itemView);
            textView = (TextView) itemView.findViewById(R.id.localText);


        }

    }
}
</code></pre>

<p>Layout xml file</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    &gt;

    &lt;android.support.v7.widget.RecyclerView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/innerRview"
        android:orientation="horizontal"
        app:layoutManager="android.support.v7.widget.LinearLayoutManager"
        android:descendantFocusability="afterDescendants"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>How to select item of <code>Recyclerview</code> with help of Dpad key?</p>