Reputation: 8118
I'm having a relativeLayout with textviews and imageviews.
When I overlay the layout like this:
color = new ColorDrawable(Color.argb(80, 0, 0, 0));
mMainLayout.setBackground(color);
The layout has some darker color.
Except the imageviews they keep the same. So I thought I give it a try with
statsImage.setImageAlpha(255);
But still the image keeps the same.
Can someone help me?
Someone also an explanation why the imageview doesn't get the overlay? It is a child of the layout:
<ImageView
android:id="@+id/headerImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_profile_pic" />
<ImageView
android:id="@+id/statsImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="70dp"
android:background="@drawable/shape_stats" />
</RelativeLayout>
EDIT:
I now got this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/overlayMainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
And I set the background color like this:
color = new ColorDrawable(Color.argb(80, 0, 0, 0));
mMainViewOverlay.setBackground(color);
Upvotes: 0
Views: 414
Reputation: 8118
Found the solution. You need to use the code like in my edit. You just need to add the "black" view at the end of the relative layout otherwise all the things you add after the view lay on top off the view.
Upvotes: 1