2017-07-20 3 views
0

Ich habe eine Light-Theme-App und in einem der Bildschirme habe ich eine Recycler-Ansicht, dass ich dunkel sein muss.Light Theme App mit Dark Theme RecyclerView

Ich habe versucht, das Thema der Recyclerview zu "@ style/ThemeOverlay.AppCompat.Dark", aber der RecyclerView bleibt mit der gleichen Hintergrundfarbe, nur der Text erscheint als weiß auf der Vorschau, aber auf dem realen Gerät es Stills zeigt sich als dunkel (und wenn ich also einen Hintergrund anlege, kann es nicht gelesen werden).

Dies ist der Punkt Layout:

<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> 

Und das ist, wie ich meinen recyclerview erklären:

 <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"/> 
+0

manuell eingestellt 'android.textColor =„# ffffff“' für Textview –

Antwort

0

Fügen Sie diese Zeile im recyclerview xml Ihre Hintergrundfarbe zu ändern.

android:background="@color/your_background_color" 
+0

Ich weiß, wie der Hintergrund ändern oclor ich gerade nicht explizit gezwungen werden soll, um die Textfarbe für jeden Textview zu erklären, so dass ich mag nur Wechseln Sie das Thema. – MichelReap