2017-03-09 2 views
1

J'ai un problème avec Android TV et j'ai besoin de votre aide.Définir la position pour le contrôle de lecture d'Android TV

Code de mise en page est ci-dessous:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 

<VideoView 
    android:id="@+id/videoView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="center" 
    /> 

<fragment 
    android:id="@+id/playback_controls_fragment" 
    android:name="com.sharewis.leonettv.PlaybackOverlayFragment" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 

et mise en page rendu:

enter image description here

Comment puis-je définir la position pour le contrôle de lecture de Android TV (etc: bas, haut ...)?

Répondre

0

I Commande manuelle dimen de rembourrage de contrôle de lecture (comprennent haut et bas) avec lb_playback_controls_padding_top et lb_playback_controls_padding_bottom

0

changement du ViewGroup de à

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <VideoView 
     android:id="@+id/videoView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_gravity="center" 
     /> 

    <fragment 
     android:id="@+id/playback_controls_fragment" 
     android:name="com.sharewis.leonettv.PlaybackOverlayFragment" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     /> 
</RelativeLayout> 

et ajouter deux attributs xml layout_alignParentBottom et layout_centerHorizontal se fragmenter comme indiqué ci-dessus.

Il aligne le bord inférieur playback_control_fragment de ce point de vue correspond au bord inférieur du parent et des centres de cet enfant à l'horizontale dans son parent.

https://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html