Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Android's DataBinding work with the Transitions/Scenes framework?

Does Android's DataBinding library work with the Transitions framework?

        Scene scene = Scene.getSceneForLayout(this, R.layout.creditcardentryview_scene2_expanded, this.getContext());
        TransitionManager.go(scene);
        scene2Binding = CreditcardentryviewScene2ExpandedBinding.bind(this);

Attempting the code above throws this error: view tag isn't correct on view:null

like image 423
ZakTaccardi Avatar asked Dec 19 '22 18:12

ZakTaccardi


1 Answers

You should bind the layout prior to creating the Scene:

CreditcardentryviewScene2ExpandedBinding binding = CreditcardentryviewScene2ExpandedBinding.inflate(getLayoutInflater(), this, false);
Scene scene = new Scene(this, binding.getRoot());
TransitionManager.go(scene);

The bind(this) is failing because this isn't a bound view. this is the scene root! So you can also do this:

Scene scene = Scene.getSceneForLayout(this, R.layout.creditcardentryview_scene2_expanded, this.getContext());
TransitionManager.go(scene);
scene2Binding = CreditcardentryviewScene2ExpandedBinding.bind(this.getChildAt(0));
like image 63
George Mount Avatar answered Dec 21 '22 10:12

George Mount