2

I tried to fit in a android tv app navigation menu. but it can not be selected. If I use the mouse go. but remote from the nexus player does not work. can solve? or it is not possible to use remote NavigationView? Thank you

code:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="ro.vrt.videoplayerstreaming.Work_screen">

    <TextClock
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textClock"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true" />

    <RelativeLayout
        android:layout_width="220dp"

        android:layout_height="match_parent">

        <RelativeLayout
            android:orientation="vertical"
            android:layout_width="220dp"
            android:layout_height="160dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true"
            android:background="@drawable/layout_colturi_rotunjite"
            android:layout_centerInParent="true"
            android:layout_marginTop="32dp"
            android:id="@+id/relativeLayout">
            <de.hdodenhof.circleimageview.CircleImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/profile_image"
                android:layout_width="76dp"
                android:layout_height="76dp"
                android:src="@drawable/profile"
                app:border_color="#FF000000"
                android:layout_above="@+id/username"
                android:layout_centerHorizontal="true" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="GrupoVRT"
                android:textSize="14sp"
                android:textColor="#FFF"
                android:textStyle="bold"
                android:gravity="left"
                android:paddingBottom="4dp"
                android:id="@+id/username"
                android:layout_above="@+id/email"
                android:layout_centerHorizontal="true" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="VRT Player"
                android:id="@+id/email"
                android:gravity="left"
                android:textSize="14sp"
                android:textColor="#fff"
                android:layout_alignParentBottom="true"
                android:layout_alignStart="@+id/username"
                android:layout_marginBottom="32dp" />

        </RelativeLayout>

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/relativeLayout"
            android:layout_alignParentStart="true">

            <android.support.design.widget.NavigationView
                android:id="@+id/navigation_view"
                android:layout_height="match_parent"
                android:layout_width="wrap_content"
                android:layout_gravity="start"
                app:menu="@menu/drawer"
                android:layout_below="@+id/relativeLayout" />

        </LinearLayout>

    </RelativeLayout>
</RelativeLayout>

drawer:

<?xml version="1.0" encoding="utf-8"?>

<group android:id="@+id/grp1">
    <item
        android:id="@+id/List_View"
        android:state_focused="true"
        android:state_pressed="true"
        android:checked="false"
        android:icon="@drawable/ic_view_list_white_24dp"
        android:title="@string/inbox_string" />

    <item
        android:id="@+id/Live_streaming"
        android:state_focused="true"
        android:state_pressed="true"
        android:checked="false"
        android:icon="@drawable/ic_view_stream_white_24dp"
        android:title="@string/starred_string" />

    <item
        android:id="@+id/Torrent_streaming"
        android:state_focused="true"
        android:state_pressed="true"
        android:checked="false"
        android:icon="@drawable/ic_play_circle_outline_white_24dp"
        android:title="@string/sent_mail_string" />
</group>
<group android:id="@+id/grp2">
    <item
        android:id="@+id/Send_torrent_android_tv"
        android:checked="false"
        android:icon="@drawable/ic_important_devices_white_24dp"
        android:title="@string/send_torrent_android_tv" />

</group>

<group android:id="@+id/grp3">
    <item
        android:id="@+id/Playlist_streaming"
        android:checked="false"
        android:icon="@drawable/ic_playlist_add_check_white_24dp"
        android:title="@string/playlist_streaming" />

    <item
        android:id="@+id/Playlist_torrent"
        android:checked="false"
        android:icon="@drawable/ic_playlist_play_white_24dp"
        android:title="@string/playlist_torrent" />
</group>
<group android:id="@+id/grp4">
    <item
        android:id="@+id/File_explorer"
        android:checked="false"
        android:icon="@drawable/ic_folder_open_black_24dp"
        android:title="@string/file_explorer" />

</group>

<group android:id="@+id/gr5">
<item
    android:id="@+id/More_app_GrupoVRT"
    android:checked="false"
    android:icon="@drawable/ic_shop_white_24dp"
    android:title="@string/more_app_grupovrt" />

Diaconu Liviu
  • 211
  • 4
  • 13

1 Answers1

0

Based on the documentation, I think you can use D-pad.

On a TV device, users navigate with controls on a remote control device, using either a directional pad (D-pad) or arrow keys.

The Android framework handles directional navigation between layout elements automatically, so you typically do not need to do anything extra for your app. However, you should thoroughly test navigation with a D-pad controller to discover any navigation problems.

Check the above link to understand more about TV device.

For your concern about NavigationView, you can check/read this document for more information.

KENdi
  • 7,576
  • 2
  • 16
  • 31