Неправильный размер PlayerView внутри NestedScrollView с шириной wrap_content - PullRequest
1 голос
/ 29 января 2020

Когда PlayerView находится внутри FrameLayout, оно корректно масштабируется до размера видео:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/playerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</FrameLayout>

enter image description here

Однако после замены компоновка с NestedScrollView, кажется, что представление принимает только высоту элементов управления при расчете высоты PlayerView:

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/playerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</androidx.core.widget.NestedScrollView>

enter image description here

Как можно Я решил эту проблему?

1 Ответ

1 голос
/ 29 января 2020

Решение состоит в том, чтобы добавить следующий параметр к PlayerView:

app:resize_mode="fixed_width"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...