I'm trying to make a timeout gauge bar animation effect:
The width of a lengthy colorful bitmap image is decreasing, but not x-scaling.
so the image looks not changing and the visible area shrinks.
I couldn't find the sole ImageView clipping or masking support in android.
And I managed to get the clipping effect by surrounding the ImageView in ViewGroup like:
<FrameLayout android:id="@+id/shrink_box" ...>
<ImageView android:src="@drawable/still_image" ...>
</FrameLayout>
then changing the shrink_box's width will clip the portion of the still_image.
But I failed to change the width of the view smoothly. I tried to change the LayoutParam.width in applyTransformation() but got开发者_运维百科 an Exception, it seems not allowed.
How can I make an Animation that changes the width of the view. OR is there a proper method to achieve the above effect?
You are trying to reinvent the wheel here, just use a ProgressBar and set the progress drawable to your image. In your xml layout give the ProgressBar this style to make it an actual bar rather than a wheel
style="@android:style/Widget.ProgressBar.Horizontal"
精彩评论