Android animation for dynamically loaded image -
i want create animation image loaded vertical linear layout dynamically. when triggered image slide down alpha set 0 (this slide content below down hope) fade image in. being new android animations having trouble. right i'm trying fade in work, here have:
fade_in.xml
<?xml version="1.0" encoding="utf-8"?> <alpha xmlns:android="https://chemas.android.com/ap/res/android" android:interpolator="@android:anim/anticipate_interpolator" android:fromalpha="0.0" android:toalpha="1.0" android:duration="5000" > </alpha> in activity:
animation animation = animationutils.loadanimation(context, r.anim.fade_in); imageview image = new imageview(context); image.setimageresource(r.drawable.my_image); image.setlayoutparams(layoutparams); image.setalpha(0); ((viewgroup) view).addview(image, 0); image.startanimation(animation); the image being loaded context below shifted down, if never fades in. working having image slide down dynamica add not choppy.
thanks in advance.
you have typo in xmlns:android tag.
it should be
xmlns:android = "http://schemas.android.com/apk/res/android"
with being corrected, remove image.setalpha(0); , should animate. afraid cannot give reason why doesn't work alpha attribute set 0.
regarding slide down animation, have subclass animation. have @ answer think can want: https://stackoverflow.com/a/5122460/871102
Comments
Post a Comment