0

Hey all I am trying to figure out how to highlight the current focused image I am on when using a d-pad/remote control. This is on an Android/Google TV so I need to know what image has focus/what image I am currently on.

I've googled and this is the only thing I can find that may be something useful.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@Color/black" />
    <item android:state_focused="true" android:drawable="@Color/black" />
    <item android:state_selected="true" android:drawable="@Color/black" />
</selector>

My layout for my image is this:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:orientation="horizontal"
    android:paddingStart="5dp"
    tools:ignore="RtlSymmetry">

    <ImageView
        android:id="@+id/movieImg"
        android:layout_width="174dp"
        android:layout_height="245dp"
        android:contentDescription="@string/moviedescription"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/tv_title"
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:gravity="center"
        android:autoSizeTextType="uniform"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/movieImg"
        app:layout_constraintVertical_bias="1.0"
        tools:targetApi="o" />

</androidx.constraintlayout.widget.ConstraintLayout>

Something like this:

enter image description here

or like this:

enter image description here

What can I do to accomplish this task?

StealthRT
  • 10,108
  • 40
  • 183
  • 342

0 Answers0