Show transparent color filter on a View after clicking it
Posted
by
Maarten
on Stack Overflow
See other posts from Stack Overflow
or by Maarten
Published on 2012-12-05T22:49:53Z
Indexed on
2012/12/05
23:03 UTC
Read the original article
Hit count: 182
android
So. You know how when you click a post in the Google+ app, the entire View becomes blue. I want to do that as well, but with an ImageView.
I have the following code snippet, setting the actual image as the background and the selector as the main resource. This looks good, but doesn't respect scaleType for the background image:
<ImageView
android:id="@+id/painting_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/img"
android:src="@drawable/selector"
android:scaleType="centerCrop" />
By the way, @drawable/selector
is just a selector that shows a tranparent color for state_pressed
:
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#44521400" />
</shape></item>
How can I make this work while respecting the scaleType?
© Stack Overflow or respective owner