У меня есть класс CashHistoryActivity
public class CashHistoryActivity extends AppCompatActivity
и макет
<androidx.viewpager2.widget.ViewPager2
android:visibility="gone"
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
У меня также есть cash_item. 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="20dp"
android:layout_margin="8dp" >
</androidx.cardview.widget.CardView>
</LinearLayout>
В методе запуска
if (mode.equals("light")){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
else if (mode.equals("dark")){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
Во фрагментах все работает с теми же настройками, но в CashHistoryActivity это выглядит следующим образом


Кто-нибудь знает, как применить темный режим так же, как первое изображение?