Itβs a little difficult to say what kind of transition you are trying to make between these two images. So, do you want to start with a black and white image, but does it switch from B / W to color with cross fading, or do you slowly want to apply pieces of the color image from bottom to top along the B / W part?
If your last choice, your actual image will consist of two drawings together inside the <layer-list> . One is static and the other is ClipDrawable , which will display part of the color image based on its level value. For example, create an XML file:
Res / extract / progress_background.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/ic_launcher_bw"/> </item> <item> <clip android:clipOrientation="vertical" android:gravity="bottom" android:drawable="@drawable/ic_launcher"/> </item> </layer-list>
Then set Drawable to something like ImageView to display the progress, and change the value using calls to setLevel() , i.e.
//This is any view subclass that you have chosen to do this ImageView progress; progress.setImageResource(R.drawable.progress_background); //Adjust the progress by adjusting the drawable level progress.setImageLevel(500); // -- OR -- progress.getDrawable().setLevel(500);
Drawing levels are set by default in the range from 0 to 10000 for full disclosure of the image.
NTN
source share