cardslib
cardslib copied to clipboard
TextOverImage background color
Hi, thanks for awesome library. using recycler view and Material card with image and text, as images coming from api may have different background color, I want to set a black overlay on textOverImage area then what ever color the image has the text with white color will be visible nicely, I searched your code and couldn't find any method or customization for that, even frameLayout containing that doesn't have id, can you help me?
+1 to this issue. I'm not sure if there's anything to override in the xml either.
Hey man, fortunately I implemented this :) you just have to change native_thumbnail_largematerial.xml from:
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_thumbnail_image"
android:layout_height="match_parent"
android:layout_width="match_parent"
style="@style/card.native.card_thumbnail_image"/>
to this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/card_thumbnail_image"
style="@style/card.native.card_thumbnail_image"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:id="@+id/newsImageTransparentLayer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/main_background">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@android:color/transparent"/>
</RelativeLayout>
</RelativeLayout>
I just put an imageView with transparent color (main_background = #77000000) over the original imageView, so the text could be nicely visible :) hope it helps