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:
How can I set position for Playback control of Android TV (etc: bottom, top...)?
android exoplayer android-exoplayer
add a comment |
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:
How can I set position for Playback control of Android TV (etc: bottom, top...)?
android exoplayer android-exoplayer
add a comment |
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:
How can I set position for Playback control of Android TV (etc: bottom, top...)?
android exoplayer android-exoplayer
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:
How can I set position for Playback control of Android TV (etc: bottom, top...)?
android exoplayer android-exoplayer
android exoplayer android-exoplayer
edited Mar 22 '17 at 15:25
asked Mar 9 '17 at 1:52
Louis Nguyen
134214
134214
add a comment |
add a comment |
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
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
add a comment |
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
add a comment |
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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
I manual override padding dimen of Playback control (include top and bottom) with lb_playback_controls_padding_top and lb_playback_controls_padding_bottom
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
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Mar 9 '17 at 3:08
mndivya
35
35
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Nov 13 at 22:24
dell116
3,38294163
3,38294163
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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