Set position for Playback control of Android TV











up vote
1
down vote

favorite












I have problem with Android TV and I need your help.



Below is layout code:



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




And layout rendered:



enter image description here



How can I set position for Playback control of Android TV (etc: bottom, top...)?










share|improve this question




























    up vote
    1
    down vote

    favorite












    I have problem with Android TV and I need your help.



    Below is layout code:



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




    And layout rendered:



    enter image description here



    How can I set position for Playback control of Android TV (etc: bottom, top...)?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have problem with Android TV and I need your help.



      Below is layout code:



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




      And layout rendered:



      enter image description here



      How can I set position for Playback control of Android TV (etc: bottom, top...)?










      share|improve this question















      I have problem with Android TV and I need your help.



      Below is layout code:



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




      And layout rendered:



      enter image description here



      How can I set position for Playback control of Android TV (etc: bottom, top...)?







      android exoplayer android-exoplayer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 '17 at 15:25

























      asked Mar 9 '17 at 1:52









      Louis Nguyen

      134214




      134214
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom






          share|improve this answer





















          • This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
            – dell116
            Nov 13 at 22:29




















          up vote
          0
          down vote













          change the ViewGroup from to



              <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>


          and add two xml attributes layout_alignParentBottom and layout_centerHorizontal to fragment as shown above.



          It aligns playback_control_fragment bottom edge of this view match the bottom edge of the parent and centers this child horizontally within its parent.




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







          share|improve this answer




























            up vote
            0
            down vote













            After updating to API v28 / leanback support v28.x.x I found the answer provided by Louis Nguyen to no longer be working.



            Looking at the PlaybackSupportFragment.setVerticalGridViewLayout() source code for API 28 / Leanback support 28.x.x, one can see Google changed how this alignment is being set.



            TLDR



            If you're using API v28 / Leanback support v28.x.x :




            • override the dimen value "lb_playback_other_rows_center_to_bottom"

            • A value of 135dp positions the playback controls to a position similar of that when we were using API v26 / LeanbackSupport v26.


            If you're using API v26 / Leanback support v26.x.x




            • override the dimen value "lb_playback_controls_padding_top"

            • A value of 300dp keeps the controls at a place around the bottom with some good bottom margin






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42685245%2fset-position-for-playback-control-of-android-tv%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              0
              down vote



              accepted










              I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom






              share|improve this answer





















              • This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
                – dell116
                Nov 13 at 22:29

















              up vote
              0
              down vote



              accepted










              I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom






              share|improve this answer





















              • This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
                – dell116
                Nov 13 at 22:29















              up vote
              0
              down vote



              accepted







              up vote
              0
              down vote



              accepted






              I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom






              share|improve this answer












              I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 9 '17 at 2:32









              Louis Nguyen

              134214




              134214












              • This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
                – dell116
                Nov 13 at 22:29




















              • This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
                – dell116
                Nov 13 at 22:29


















              This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
              – dell116
              Nov 13 at 22:29






              This is no longer working on API 28 / Leanback support v28.x.x. See my answer if you want to save yourself 45 minutes of source code searching :-)
              – dell116
              Nov 13 at 22:29














              up vote
              0
              down vote













              change the ViewGroup from to



                  <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>


              and add two xml attributes layout_alignParentBottom and layout_centerHorizontal to fragment as shown above.



              It aligns playback_control_fragment bottom edge of this view match the bottom edge of the parent and centers this child horizontally within its parent.




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







              share|improve this answer

























                up vote
                0
                down vote













                change the ViewGroup from to



                    <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>


                and add two xml attributes layout_alignParentBottom and layout_centerHorizontal to fragment as shown above.



                It aligns playback_control_fragment bottom edge of this view match the bottom edge of the parent and centers this child horizontally within its parent.




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







                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  change the ViewGroup from to



                      <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>


                  and add two xml attributes layout_alignParentBottom and layout_centerHorizontal to fragment as shown above.



                  It aligns playback_control_fragment bottom edge of this view match the bottom edge of the parent and centers this child horizontally within its parent.




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







                  share|improve this answer












                  change the ViewGroup from to



                      <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>


                  and add two xml attributes layout_alignParentBottom and layout_centerHorizontal to fragment as shown above.



                  It aligns playback_control_fragment bottom edge of this view match the bottom edge of the parent and centers this child horizontally within its parent.




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








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 9 '17 at 3:08









                  mndivya

                  35




                  35






















                      up vote
                      0
                      down vote













                      After updating to API v28 / leanback support v28.x.x I found the answer provided by Louis Nguyen to no longer be working.



                      Looking at the PlaybackSupportFragment.setVerticalGridViewLayout() source code for API 28 / Leanback support 28.x.x, one can see Google changed how this alignment is being set.



                      TLDR



                      If you're using API v28 / Leanback support v28.x.x :




                      • override the dimen value "lb_playback_other_rows_center_to_bottom"

                      • A value of 135dp positions the playback controls to a position similar of that when we were using API v26 / LeanbackSupport v26.


                      If you're using API v26 / Leanback support v26.x.x




                      • override the dimen value "lb_playback_controls_padding_top"

                      • A value of 300dp keeps the controls at a place around the bottom with some good bottom margin






                      share|improve this answer

























                        up vote
                        0
                        down vote













                        After updating to API v28 / leanback support v28.x.x I found the answer provided by Louis Nguyen to no longer be working.



                        Looking at the PlaybackSupportFragment.setVerticalGridViewLayout() source code for API 28 / Leanback support 28.x.x, one can see Google changed how this alignment is being set.



                        TLDR



                        If you're using API v28 / Leanback support v28.x.x :




                        • override the dimen value "lb_playback_other_rows_center_to_bottom"

                        • A value of 135dp positions the playback controls to a position similar of that when we were using API v26 / LeanbackSupport v26.


                        If you're using API v26 / Leanback support v26.x.x




                        • override the dimen value "lb_playback_controls_padding_top"

                        • A value of 300dp keeps the controls at a place around the bottom with some good bottom margin






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          After updating to API v28 / leanback support v28.x.x I found the answer provided by Louis Nguyen to no longer be working.



                          Looking at the PlaybackSupportFragment.setVerticalGridViewLayout() source code for API 28 / Leanback support 28.x.x, one can see Google changed how this alignment is being set.



                          TLDR



                          If you're using API v28 / Leanback support v28.x.x :




                          • override the dimen value "lb_playback_other_rows_center_to_bottom"

                          • A value of 135dp positions the playback controls to a position similar of that when we were using API v26 / LeanbackSupport v26.


                          If you're using API v26 / Leanback support v26.x.x




                          • override the dimen value "lb_playback_controls_padding_top"

                          • A value of 300dp keeps the controls at a place around the bottom with some good bottom margin






                          share|improve this answer












                          After updating to API v28 / leanback support v28.x.x I found the answer provided by Louis Nguyen to no longer be working.



                          Looking at the PlaybackSupportFragment.setVerticalGridViewLayout() source code for API 28 / Leanback support 28.x.x, one can see Google changed how this alignment is being set.



                          TLDR



                          If you're using API v28 / Leanback support v28.x.x :




                          • override the dimen value "lb_playback_other_rows_center_to_bottom"

                          • A value of 135dp positions the playback controls to a position similar of that when we were using API v26 / LeanbackSupport v26.


                          If you're using API v26 / Leanback support v26.x.x




                          • override the dimen value "lb_playback_controls_padding_top"

                          • A value of 300dp keeps the controls at a place around the bottom with some good bottom margin







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 13 at 22:24









                          dell116

                          3,38294163




                          3,38294163






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42685245%2fset-position-for-playback-control-of-android-tv%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                              ComboBox Display Member on multiple fields

                              Is it possible to collect Nectar points via Trainline?