Lightテーマアプリがあり、画面の1つにリサイクルビューがあり、暗くする必要があります。暗いテーマのLightテーマアプリRecyclerView
私はrecyclerviewのテーマを "@ style/ThemeOverlay.AppCompat.Dark"に設定しようとしましたが、RecyclerViewは同じ背景色を維持していますが、テキストはプレビューで白く表示されますが、スティルは暗く表示されます(したがって、バックグラウンドを置くと読み込めません)。
これは、アイテムのレイアウトです:
<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:gravity="center_vertical"
android:orientation="horizontal"
style="@style/ThemeOverlay.AppCompat.Dark"
android:padding="@dimen/single_padding"
android:theme="@style/Base.ThemeOverlay.AppCompat.Dark">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="52''"
style="@style/ThemeOverlay.AppCompat.Dark"
tools:text="52''"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/single_padding"
android:src="@mipmap/ic_launcher_round"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Subtitle"/>
</LinearLayout>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/logo"
/>
</LinearLayout>
そして、これは私が私のrecyclerviewを宣言する方法です:
<android.support.v7.widget.RecyclerView
android:id="@+id/highlights_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ThemeOverlay.AppCompat.Dark"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/highlight_list_item"/>
手動で設定 'android.textColorは=「#1 FFFFFF」'のTextView –