2017-04-19 8 views
-1

私は次の問題を抱えています。私は面白い異なる灰色の色で表示されている '通常の'カードビューを持っています。どうしてか分かりません。 これは次のようになります。 enter image description heregreyとbrownの色を表示するrecyclerviewのCardview - android

なぜノーマルホワイトではありませんか?

ここでここでitem_row

<?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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     app:cardCornerRadius="5dp" 
    > 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_margin="5dp"> 
      <TextView 
       android:id="@+id/textViewItemName" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_toLeftOf="@+id/checkBox" 
       android:layout_toStartOf="@+id/checkBox" 
       android:textColor="#000" 
       android:layout_centerVertical="true" 
       android:text="TextView" /> 

      <CheckBox 
       android:id="@+id/checkBox" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentEnd="true" 
       android:layout_alignParentRight="true" 
       android:layout_centerVertical="true" 
       android:text="" /> 

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

</LinearLayout> 

のXMLは、活動のためのlayout_contentです:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_choose" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 

    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.apps.reuven.choosepicture.ChoosePicturesToDisplayActivity" 
    tools:showIn="@layout/activity_choose_to_display"> 


    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recyclerViewToDisplay" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    </android.support.v7.widget.RecyclerView> 





    </RelativeLayout> 

マニフェスト アンドロイドでのテーマ:テーマ= "@スタイル/ AppTheme">

...

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

答えて

1
はこれにあなたのテーマを変更

:あなたはあなたのビューの背景色が暗く表示されている理由ですDarkテーマTheme.AppCompat.NoActionBarを使用している

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 
+0

ありがとうございました。とても簡単。 – RJB

+0

できます – RJB

1

LightテーマTheme.AppCompat.Light.NoActionBarをお試しください。

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 
関連する問題