2016-07-05 7 views
0

表示レイアウトに問題が発生しました。 Relativelayout @ + id/mediaは、表示すると表示されません。 Relativelayout @ + id/media2の下に残り、dpadから選択できますが、もう一方の下に残ります。Android Tvボタンが選択されていません

の場合は、メディアと第1および第2のメディアを入れます。メディアが表示されているときに選択可能なdpadはありません。

media2の上に最初に書き込まれていますが、メディアを作成する順序がありますか? は、画面上の別のアイテムにフォーカスをコントロールしようとしているように思え

レイアウト

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    android:id="@+id/app_video_box" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="#000" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:id="@+id/media" 
     android:layout_marginLeft="32dp" 
     android:layout_marginRight="32dp" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:gravity="center_vertical|center_horizontal|center" 
      android:layout_marginLeft="32dp" 
      android:layout_marginRight="32dp" 
      android:animateLayoutChanges="true" 
      android:background="#e72a2a" 
      android:id="@+id/relativeLayout"> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Back" 
       android:id="@+id/button2" 
       android:layout_alignParentTop="true" 
       android:layout_toRightOf="@+id/button" 
       android:layout_toEndOf="@+id/button" /> 
      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Play" 
       android:id="@+id/button" /> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Next" 
       android:id="@+id/button3" 
       android:layout_alignParentTop="true" 
       android:layout_toRightOf="@+id/button2" 
       android:layout_toEndOf="@+id/button2" /> 

     </RelativeLayout> 

     <SeekBar 
      android:id="@+id/app_video_seekBar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:focusable="true" 
      android:layout_above="@+id/relativeLayout" 
      android:layout_alignLeft="@+id/relativeLayout" 
      android:layout_alignStart="@+id/relativeLayout" 
      android:layout_alignRight="@+id/relativeLayout" 
      android:layout_alignEnd="@+id/relativeLayout" /> 


    </RelativeLayout> 
    <RelativeLayout 
     android:id="@+id/media2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <tcking.github.com.giraffeplayer.IjkVideoView 
      android:id="@+id/video_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 
    </RelativeLayout> 

</RelativeLayout> 
+0

他のコントロールと同じように、mediaとmedia2の相対的な位置を指定する必要があります。 – muratgu

+0

あなたは私に詳細を教えてもらえますか? –

答えて

0

ありがとうございます。あなたはこのために特別にXMLタグを使用することができます。

android:nextFocusForward="@+id/media2"

android:nextFocusDown="@+id/media2"

あなたはより多くを学ぶためにdocs for keyboard navigationで見ることができます。

0

Android TVでは、フォーカス可能な場合にのみui要素のみが選択されます。 これは、xml属性またはコードのいずれかによって実現します。

view.setFocusable(true) 

又は

android:focusable="true". 

フォーカスを転送する人に、各UI要素のためのルールを設定します。方向下、上、右、またはを残すことができ

android:nextFocus{direction}="view_id". 

フォーカス可能なアイテム

関連する問題