Android, przesuwanie buttonu z animacją

0

Witam,

Ucze się Javy i SDK Androida. Chcę stworzyc aplikację ktora bedzie zamieniala miejscami 2 buttony. Wyczytalem ze powinienem do tego uzyc OjbectAnimator bo ustawi on na stale po przesunieciu pozycje. Jednak tak to nie dziala. Owszem buttony zamieniaja sie miejscami ale nie zmienia sie wartosc getLeft() i getRight(), a po odpaleniu kolejnych animacji z pozycja startowa 0 zaczyna sie one od miejscach ktorym ustawilem przycisk w XML. W dokumentacji jest info o funkcji bez ktorej ObjectAnimator nie dziala prawidlowo. W dokumentacji nie ma zadnego przykladu, a samo utworzenie tej funkcji nie powoduje ze ona sie wywoluje - sprawdzalem toastem.

http://developer.android.com/guide/topics/graphics/prop-animation.html#object-animator

"The object property that you are animating must have a setter function (in camel case) in the form of set(). Because the ObjectAnimator automatically updates the property during animation, it must be able to access the property with this setter method. For example, if the property name is foo, you need to have a setFoo() method. If this setter method does not exist, you have three options: Add the setter method to the class if you have the rights to do so. Use a wrapper class that you have rights to change and have that wrapper receive the value with a valid setter method and forward it to the original object. Use ValueAnimator instead."

0

Pokaz kod, bez tego ani rusz.

1 użytkowników online, w tym zalogowanych: 0, gości: 1