RecyclerView
のCardView
に問題があります。 私のCardView
が突然黒くなり、私のRatingBar
が青くなりました。私はInfiniteRecyclerView
を使用していますが、それを単純な0に変更することは効果がありません。 CardView
の背景色を白に変更することはできますが、RatingBar
はまだ青です。これは、何が起こっているかの例です:CardViewが突然黒くなった
RecyclerView
を使用して、それだけで正常に見える
。次に例を示します。
これはsingle_recipe_recycler_item.xml
レイアウトファイルです:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@+id/recipe_recycler_image"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp">
<!-- RealmRecipe Title -->
<TextView
android:id="@+id/recipe_recycler_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="end"
android:text="Very very very very very very long title"
android:textColor="@color/colorBlack"
android:textSize="@dimen/title"
android:textStyle="bold" />
<!-- Publisher -->
<TextView
android:id="@+id/recipe_recycler_publisher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/recipe_recycler_title"
android:layout_marginTop="5dp"
android:text="Publisher"
android:textColor="@color/colorBlack"
android:textSize="@dimen/genre"
android:textStyle="italic" />
<!-- Rating -->
<RatingBar
android:id="@+id/recipe_recycler_rating_bar"
style="@style/Widget.AppCompat.RatingBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/recipe_recycler_publisher"
android:layout_marginTop="5dp"
android:isIndicator="true"
android:max="5" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
これは私のAppTheme
です:
<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>
ですが、なぜでしょうか? CardView
にバグはありますか?どのようにこれを修正するための任意の提案?
'LinearLayout'で' selectableItemBackground'の色は何ですか? – Razor
これは波紋効果の背景描画可能です。 'selectableItemBackground'を適用する前にCardViewが黒くなったので、問題の原因ではありません。 – frozzyk
あなたのアプリをテストしているAndroidのバージョンは何ですか? – Razor