image - Android: Overlay a picture (jpg) with transparency -


i have picture (jpg) want display on screen. additionally picture should covered partially transparent effect. transparent cover should dynamic. e.g. each day more of picture shown. here picture show mean: enter image description here

i have picture without gray cover , want add cover in different steps.

can give me hint how that.

you can widgets:

framelayout general mechanism overlaying view on top of another:

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="wrap_content"> <imageview       android:id="@+id/image"     android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:src="@drawable/my_image"/> <view     android:id="@+id/overlay"     android:layout_width="fill_parent"     android:layout_height="fill_parent"/> </framelayout> 

then in java code can dynamically set transparency of overlay:

view overlay = (view) findviewbyid(r.id.overlay); int opacity = 200; // 0 255 overlay.setbackgroundcolor(opacity * 0x1000000); // black variable alpha framelayout.layoutparams params =     new framelayout.layoutparams(framelayout.layoutparams.fill_parent, 100); params.gravity = gravity.bottom; overlay.setlayoutparams(params); overlay.invalidate(); // update view 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -