2016-04-18 16 views
1

Ich habe versucht, in eine Android-TV-App Navigationsmenü passen. aber es kann nicht ausgewählt werden. Wenn ich die Maus benutze, geh. aber fern vom nexus player funktioniert das nicht. kann lösen? oder es ist nicht möglich, Remote-NavigationView zu verwenden? DankeAndroid TV-Menü ist nicht aus d-Pad

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> 

Schublade:

<?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" /> 

+0

Können Sie etwas mehr erklären? Können Sie nicht mit 'D-PAD' navigieren? –

+0

Ja, Sie können dieses Menü nicht auswählen, wenn Sie ein D-Pad verwenden. Es ist wie dort. –

+0

Siehe meine Antwort hier http://stackoverflow.com/questions/34720761/android-tv-app-unable-to-select-list-item-with-remote/34761680#34761680 –

Antwort

0

auf das Basierend documentation Ich denke du kannst D-Pad benutzen.

Auf einem TV-Gerät navigieren Benutzer mit Steuerelementen auf einem Fernbedienungsgerät, entweder mit einem Steuerkreuz (D-Pad) oder mit den Pfeiltasten.

Das Android-Framework übernimmt die Richtungsnavigation zwischen Layoutelementen automatisch, sodass Sie in der Regel keine zusätzlichen Schritte für Ihre App ausführen müssen. Sie sollten jedoch die Navigation mit einem D-Pad-Controller gründlich testen, um Navigationsprobleme zu entdecken.

Überprüfen Sie den obigen Link, um mehr über das TV-Gerät zu erfahren.

Für Ihr Anliegen über NavigationView können Sie dieses Dokument für weitere Informationen lesen.