0

I placed 4 EditText controls in my activity_main.xml. I want cycle over these controls with TV remote controller using DPAD-UP/DOWN buttons. If I press dpad-up/down next/previous edittext should be selected (focused), but not active (i should not see cursor, but I should know where I am). If I press middle "OK" button on remote then edittext should be activated and keyboard should be shown.

Just now, on first dpad_down is focused first edittext and immediately is active. This means, I am unable to do other dpad_down/up and focus other edittext. Currently active edittext does not want to release it.

Here is my layout. How to achieve correct browsing over editexts with remote controller? I am on android 11+.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical">

    <EditText
        android:id="@+id/edit1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name"
        android:nextFocusDown="@id/edit2"/>

    <EditText
        android:id="@+id/edit2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name"
        android:nextFocusUp="@id/edit1"
        android:nextFocusDown="@id/edit3"/>

    <EditText
        android:id="@+id/edit3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name"
        android:nextFocusUp="@id/edit2"
        android:nextFocusDown="@id/edit4"/>

    <EditText
        android:id="@+id/edit4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name"
        android:nextFocusUp="@id/edit3"/>


</LinearLayout>
user1063364
  • 791
  • 6
  • 21

0 Answers0