Wednesday, April 15, 2015

Android : Android Transitions (API 19) - How to setText() on TextView before transition?



I am animating a TextView using android's API19 transitions. I defined a scene that i wish to transition to:


scene = Scene.getSceneForLayout(rootLayout, R.layout.my_scene, this);


I defined my transition:


myTransition = new ChangeBounds(); myTransition.setDuration(1000); myTransition.setInterpolator(new BounceInterpolator());


And I begin transition:


TransitionManager.go(scene, myTransition);


Everything works as long as I have the android:text hardcoded. Here is what my_scene.xml looks like:



<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/textview1"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="text1"/>
</merge>


An identical TextView with the same id is in activity_main.xml, but in a different position. When I try to set the text dynamically using setText() it will not change the text. I am not very experienced with this transition API so any help is appreciated.


No comments:

Post a Comment