2017-06-22 2 views
0

Ich benutze Recyclerview, um Elemente von SQL aufzulisten, habe ich Probleme mit der Hintergrundfarbe der Element Zeilen ... Ich habe versucht, es zu ändern und nichts passiert.Recyclerview Element Zeile Hintergrundfarbe Probleme

Hier ist meine Reihe Layout

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:background="@color/bg_main" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    <LinearLayout 
     android:padding="10dp" 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <de.hdodenhof.circleimageview.CircleImageView 
      android:layout_width="80dp" 
      android:layout_height="80dp" 
      android:src="@drawable/default_avatar"/> 

     <RelativeLayout 
      android:padding="10dip" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <LinearLayout 
       android:orientation="vertical" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

      <TextView 
       android:textSize="18sp" 
       android:textColor="@color/text_color_black" 
       android:id="@+id/opponentsName" 
       android:text="Roger Nkosi" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 

      <TextView 
       android:layout_marginTop="5dp" 
       android:textSize="14sp" 
       android:textColor="@color/brownish_gray" 
       android:id="@+id/callStatus" 
       android:text="Roger Nkosi" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 
      </LinearLayout> 

      <TextView 
       android:id="@+id/dateCallMade" 
       android:layout_alignParentRight="true" 
       android:text="14:00" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 

     </RelativeLayout> 

    </LinearLayout> 
    </android.support.v7.widget.CardView> 

</LinearLayout> 

und hier ist mein Fragment Layout

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/bg_main" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context=".view.fragments.PrivateVoiceCallsDialogFragment"> 


    <!-- A RecyclerView with some commonly used attributes --> 
    <android.support.v7.widget.RecyclerView 
     android:scrollbars="vertical" 
     android:id="@+id/voice_recycler_view" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" /> 

</android.support.v4.widget.SwipeRefreshLayout> 

* bg_main ist eine einfache weiße Farbe mit oder ohne die Zeilen Artikel sind dunkel ...

+0

versuchen Sie mit dieser App: cardBackgroundColor = "@ color/colorPrimary" – MRX

+0

Vielen Dank Ich habe es verwendet und es funktioniert, vielen Dank. –

Antwort

0

Ich denke, die CardView überlappt Ihr Eltern linearLayout und damit können Sie nicht die Farbe sehen. Verwenden Sie cardBackgroundColor Eigenschaft auf CardView oder ändern Hintergrundfarbe des Kindes linearLayout

+0

es funktioniert. Vielen Dank... –

0

In Ihrer cardView Komponente verwenden Sie cardBackgroundColor Attribut, es wird die gewünschte Sache tun.

+0

Danke Mann, es funktioniert ... –

Verwandte Themen