java - Android: speeding up shared element transition between activities -
i have shared element transition between 2 activities works in following way:
intent someintent = new intent(this, someclass.class); if (build.version.sdk_int >= 21) { activityoptions options = activityoptions.makescenetransitionanimation(this , new pair<>(viewclicked.findviewbyid(r.id.someimage), "someimage") , new pair<>(viewclicked.findviewbyid(r.id.someicon), "someicon") ); startactivity(someintent, options.tobundle()); } else { startactivity(someintent); }
this works fine, transition agonisingly slow. when image first clicked on seems stall second or 2 before transition takes place. due "weight" of activity being loaded or delay configurable?
did try change duration of entertransition
, returntransition
:
private transition entertransition() { changebounds bounds = new changebounds(); bounds.setduration(2000); return bounds; } private transition returntransition() { changebounds bounds = new changebounds(); bounds.setinterpolator(new decelerateinterpolator()); bounds.setduration(2000); return bounds; }
and in oncreate
:
getwindow().setsharedelemententertransition(entertransition()); getwindow().setsharedelementreturntransition(returntransition());
Comments
Post a Comment