androidx.media3.ui.PlayerView отображается с черным фоном

Есть кастомный контроллер с элементами управления для ExoPlayer.

Разметка exo_custom.xml содержит сами элементы управления

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/exo_position"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:includeFontPadding="false"
            android:paddingLeft="@dimen/exo_player_padding_left"
            android:paddingRight="@dimen/exo_player_padding_right"
            android:textColor="@color/colorWhite"
            android:textSize="@dimen/exo_player_text_size"
            android:textStyle="bold" />

        <View
            android:id="@+id/exo_progress_placeholder"
            android:layout_width="0dp"
            android:layout_height="18dp"
            android:layout_weight="1" />

        <TextView
            android:id="@+id/exo_duration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:includeFontPadding="false"
            android:paddingLeft="@dimen/exo_player_padding_left"
            android:paddingRight="@dimen/exo_player_padding_right"
            android:textColor="@color/colorWhite"
            android:textSize="@dimen/exo_player_text_size"
            android:textStyle="bold" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/exo_controls_margin_bottom"
        android:gravity="center"
        android:orientation="horizontal">

        <ImageButton
            android:id="@+id/exo_rew"
            android:layout_width="@dimen/exo_player_btn_size"
            android:layout_height="@dimen/exo_player_btn_size"
            android:layout_marginRight="@dimen/exo_player_margin_right"
            android:background="@drawable/icon_rewind" />

        <ImageButton
            android:id="@+id/exo_playpause"
            android:layout_width="@dimen/play_btn_big_size"
            android:layout_height="@dimen/play_btn_big_size"
            android:layout_marginRight="@dimen/exo_player_margin_right"
            android:background="@drawable/icon_play" />

        <ImageButton
            android:id="@+id/exo_ffwd"
            android:layout_width="@dimen/exo_player_btn_size"
            android:layout_height="@dimen/exo_player_btn_size"
            android:background="@drawable/icon_frewind" />

    </LinearLayout>

</LinearLayout>

Разметка exo_custom_controlview.xml содержит PlayerControlView

<?xml version="1.0" encoding="utf-8"?>
<androidx.media3.ui.PlayerControlView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/custom_exo_player_control_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:show_timeout="0"
    app:hide_on_touch="false"
    app:controller_layout_id="@layout/exo_custom"/>

А разметка activity_song_player.xml содержит элементы активити, в том числе и PlayerView, для которой в качестве контроллера указана разметка выше.

<LinearLayout
    android:id="@+id/songInfo"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical"
        android:padding="@dimen/padding">

        <androidx.media3.ui.PlayerView
            android:id="@+id/player"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:controller_layout_id="@layout/exo_custom_controlview"
            app:hide_on_touch="false"
            app:show_timeout="0"
            app:shutter_background_color="@android:color/transparent"
            app:use_controller="true" />

    </LinearLayout>

</LinearLayout>

Когда запускаю приложение у PlayerView черный фон и высота больше чем занимают элементы управления. Как убрать черный фон у PlayerView и сделать так, чтобы по высоте занимала столько места сколько элементы управления?

Пробовал так: app:shutter_background_color="@android:color/transparent" но не помогло с фоном.

Сейчас вот так:

введите сюда описание изображения


Ответы (0 шт):