ConstraintLayout растягивается с ExoPlayer - PullRequest
0 голосов
/ 16 июня 2019

Итак, перед тем как ExoPlayer завершит загрузку контента, FrameLayout (player_holder), который ограничен, растягивается до полноэкранного портрета и возвращается к исходной высоте только после того, как ExoPlayer его загрузит.

Я попробовал несколько способов, включая установку андроида:layout_height до 0dp на player_holder, но тогда он не будет следовать высоте ExoPlayer и останется фиксированным.

Вот мой макет:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="false">

<FrameLayout
    android:id="@+id/player_holder"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/black"
    app:layout_constrainedHeight="true"
    app:layout_constraintBottom_toTopOf="@+id/info_panels"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/player_src"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:maxHeight="350dp"
        android:minHeight="200dp"
        app:resize_mode="fixed_width" />

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.ToolbarOverlay" />

</FrameLayout>

<FrameLayout
    android:id="@+id/info"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:background="?android:attr/windowBackground"
    android:clickable="true"
    android:focusable="true"
    app:layout_constraintBottom_toTopOf="@+id/navigation"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/player_holder" />

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/actionBarSize"
    android:background="?android:attr/windowBackground"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/info_panels"
    app:menu="@menu/navigation_full" />

</androidx.constraintlayout.widget.ConstraintLayout>
...