Android: 如何禁用应用于特定视图的应用主题?

Android: How to disable app theme being applied to a particular view?

我的片段中定义了第 3 方视频播放器视图 XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:clickable="true"
        android:focusable="true"
        android:orientation="vertical">

    <com.3rdPartyView
            android:id="@+id/videoPlayerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</LinearLayout>

视图的背景被我的主题覆盖,结果隐藏了正在播放的视频。我的主题似乎无法设置视图的背景。

我尝试在视图本身及其外部线性布局上设置以下内容:

app:theme="@android:style/Theme.Holo.Light"
android:theme="@android:style/Theme.Holo.Light"
android:background="@null"

我也试过在 fragment 膨胀后手动添加视图,但没有成功:视图的背景已更改。

我确定是这种情况,因为我在其定义中注释掉了我的主要主题的属性:android:background 并且能够看到视频。

可以通过以下方式在视图上硬编码主题:

<View ...
  android:theme="@style/ThemeOverlay.MaterialComponents.Dark"/>

我使用的第 3 方视图可能写得不正确。