Android Question Color animation by xml ?

Discussion in 'Android Questions' started by ArminKH, Aug 20, 2015.

  1. ArminKH

    ArminKH Well-Known Member

    hi
    i want to use a color animation which is in a xml file
    this animation will changed the background color of a view
    here is my xml animation code
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android=
    "http://schemas.android.com/apk/res/android">
        <objectAnimator
        android:propertyName=
    "backgroundColor"
        android:duration=
    "3000"
        android:valueFrom=
    "#FFFF8080"
        android:valueTo=
    "#FF8080FF"/>
    </set>
    and in b4a side
    Code:
    Anim = XML.LoadAnimation("search_view_entered","search_view_entered")
        Anim.Start(T8SearchTop)
    but this error appared
    Code:
    java.lang.RuntimeException: Unknown animation name: objectAnimator
    ,...
    as you can see in following link
    http://stackoverflow.com/questions/...tor-to-make-a-textview-blink-different-colors
    we have also a java code
    Code:
    AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(myContext,
    R.anim.property_animator);
    set.setTarget(myTextView);
    set.start();
    but i'm not familar with java to convert this part of code for b4a
    what is the solution?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use View.SetColorAnimated to animate the color.
     
    ArminKH likes this.
  3. ArminKH

    ArminKH Well-Known Member

    I know erel
    But i want to use that for android lower than 3
    This function is support android 3 and above
    Can u please correct my code?
     
    Last edited: Aug 21, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice