使用每個活動自定義主題

在 themes.xml 中:

<style name="MyActivityTheme" parent="Theme.AppCompat">
    <!-- Theme attributes here -->
</style>

在 AndroidManifest.xml 中:

<application
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat">
    
    <activity
        android:name=".MyActivity"
        android:theme="@style/MyActivityTheme" />

</application>