Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Transition

7166bc2cbc462ab5fd1987a76d0fe709?s=47 takahirom
February 15, 2017

Android Transition

7166bc2cbc462ab5fd1987a76d0fe709?s=128

takahirom

February 15, 2017
Tweet

More Decks by takahirom

Other Decks in Programming

Transcript

  1. "OESPJE5SBOTJUJPO UBLBIJSPN !OFX@SVOOBCMF

  2. 荈䊹稱➜ ˖ UBLBIJSPNהְֲせ⵸ד2JJUBהַ剅ְגְתׅկ ˖ %SPJE,BJHJחג
 ˑ)PXUPJNQMFNFOU.BUFSJBM%FTJHO"OJNBUJPO˒ד 涪邌׃תׅ 勻גי

  3. 5SBOTJUJPOהכ ˖ BOESPJEUSBOTJUJPO5SBOTJUJPOؙٓأ ˖ 醱侧ך4DFOFהְֲٖ؎،ؐز⽃⡘ח㼎׃גծ
 ،صً٦ءّٝ׾⡲׏גֻ׸׷

  4. 5SBOTJUJPOהכ ˖ ًٔحز ˖ ֿ׸׾갹䓸׷הְ׹׿זوذٔ،ٕرؠ ؎ٝך،صً٦ءָّٝ㹋鄲דֹ׷
 ̔(PPHMFךوذٔ،ٕرؠ؎ٝך⿫罋 㹋鄲ך1MBJEד׮׋ֻׁ׿ⵃ欽ׁ׸גְ׷ ˖ "1*-FWFM

    "OESPJE  ˖ 4VQQPSU-JCSBSZד׮⢪ִ׷״ֲחז׏׋ך ד"1*-FWFM  תד⢪ִ׷
 植朐駈׶זְ堣腉ָⶴה㢳ְ (PPHMFͷ044 1MBJEΞϓϦΑΓ
  5. 5SBOTJUJPOך珏겲 ˖ ⽃♧ך5SBOTJUJPO ˖ 'BEF鷲僇䏝ך،صً٦ءָّٝדֹ׷ ˖ $IBOHF#PVOET7JFXך⹛ֹה7JFXך㣐ֹׁךٔ؟؎ؤ ˖ זוזו ˖

    5SBOTJUJPO4FUְֻ̔אַろ׭׵׸׷ ˖ "VUP5SBOTJUJPO⡦׮5SBOTJUJPO׾䭷㹀׃זְ儗ךرؿٕؓزך 5SBOTJUJPOկ$IBOHF#PVOETה'BEFָろת׸גְ׷ ˖ $VTUPN5SBOTJUJPO荈ⴓד㹀纏׃׋5SBOTJUJPO
  6. 5SBOTJUJPOך⡲䧭倯岀 ɾίʔυ͔Βੜ੒ final Transition transition = new ChangeBounds() .setDuration(350) .setInterpolator(new

    FastOutSlowInInterpolator()); ˖ YNMַ׵欰䧭 Transition transition = TransitionInflater .from(context) .inflateTransition(R.transition.change_bounds); // res/transition/change_bounds.xml <?xml version="1.0" encoding="utf-8"?> <changeBounds xmlns:android="http://schemas.android.com/apk/res/ android" android:duration="350" android:interpolator=“@android:interpolator/fast_out_slow_in" />
  7. 5SBOTJUJPO׾ؕأةو؎ؤ ˖ 5SBOTJUJPOBEE5BSHFU 7JFXװJEזו 
 ،صً٦ءّׅٝ׷7JFX׾せ⵸זודⵖꣲׅ׷ ˖ 5SBOTJUJPOTFU1BUI.PUJPOזו׾⢪ִל嘴ⰼ䕎ך،صً٦ءّٝ ׮〳腉 "1*-FWFM

     ˖ ،صً٦ءّٝ禸ך%VSBUJPOװ*OUFSQPMBUPSזו׮♧鸐׶⢪ִ׷ final Transition transition = new ChangeBounds() .setDuration(350) .setInterpolator(new FastOutSlowInInterpolator()); transition.setPathMotion(new ArcMotion());
  8. 5SBOTJUJPO׾ⵃ欽ׅ׷倯岀 ˖ 
 ֿ׸ָ㛇劤ծ4DFOF׾ⴖ׶剏ִ׷ ˖ 5SBOTJUJPO.BOBHFSCFHJO%FMBZFE5SBOTJUJPO
 ٖ؎،ؐزך㢌刿ד荈⹛ד،صً٦ءّٝ׾אֽ׷ ˖ 8JOEPX5SBOTJUJPO
 4IBSFE&MFNFOU5SBOTJUJPO׮ֿ׸➙כֿ׸ָ㢳ְ

    ˖ 4DFOF׾⢪ֲ
  9. 4DFOF׾⢪ֲ ٖ؎،ؐزה秡➰ֽ׋TDFOF׾ⴖ׶剏ִ׷ך׫ TDFOF" TDFOF# MBZPVU@BYNM MBZPVU@CYNM 5SBOTJUJPO.BOBHFS HP TDFOF#

  10. 4DFOF׾⢪ֲ // Transition࡞੒ final Transition transition = TransitionInflater .from(context) .inflateTransition(R.transition.transition_arc);

    // TransitionΛར༻ͯ͠scene2ʹભҠ TransitionManager.go(arcScene1, transition); 鼂獳儗ח5SBOTJUJPO׾䭷㹀דֹ׷
  11. 5SBOTJUJPO׾ⵃ欽ׅ׷倯岀 ˖ 
 ֿ׸ָ㛇劤 ˖ 
 ٖ؎،ؐزך㢌刿ד荈⹛ד،صً٦ءّٝ׾אֽ׷ ˖ 8JOEPX5SBOTJUJPO
 4IBSFE&MFNFOU5SBOTJUJPO׮ֿ׸➙כֿ׸ָ㢳ְ

    w 4DFOFΛ࢖͏ ˖ 5SBOTJUJPO.BOBHFSCFHJO%FMBZFE5SBOTJUJPO
  12. 5SBOTJUJPO.BOBHFSCFHJO%FMBZF E5SBOTJUJPO ˖ 5SBOTJUJPO׾䭷㹀ׇ׆חⵃ欽ׅ׷㜥さծ㛇劤涸ח⟃♴׌ֽד، صً٦ءّٝ⳿勻׷ 痥✳䒷侧ד䭷㹀〳腉 
 TransitionManager.beginDelayedTransition(mSceneRoot); // mSceneRoot಺ͷViewΛLayoutParamsΛ͍ͬͯ͡Ҡಈ͞

    ͤΔ // params.addRule(…) mFirstButton.setLayoutParams(params);
  13. 5SBOTJUJPO.BOBHFSCFHJO %FMBZFE5SBOTJUJPO ˖ ➬穈׫ ˖ CFHJO%FMBZFE5SBOTJUJPOًاحسָㄎל׸׋儗׾剑ⴱך4DFOFה׃ծ ˖ ٖ؎،ؐزך㢌刿ד7JFXSFRVFTU-BZPVU ָㄎל׸׷ ˖

    如ח0O1SF%SBX-JTUFOFSPO1SF%SBX ָㄎל׸׋儗׾如ך4DFOFהׅ׷䠬ׄד㹋鄲ׁ ׸גְ׷ 㹋ꥷחכ4DFOFכ⢪׻זְ 5SBOTJUJPO.BOBHFSCFHJO %FMBZFE5SBOTJUJPO TDFOF 0O1SF%SBX-JTUFOFS PO1SF%SBX WJFXTFU-BZPVU1BSBNT TDFOF "VUP5SBOTJUJPO
  14. 5SBOTJUJPO.BOBHFSCFHJO %FMBZFE5SBOTJUJPO ˖ BOESPJEVJUPPMLJUEFNPT
 IUUQTHJUIVCDPNHPPHMFBOESPJEVJUPPMLJUEFNPT ˖ ֿך؟ٝفٕ،فָٔ4VQQPSU-JCSBSZח״׏ג؟ٝفٕ 㹋鄲ׁ׸גְגֶׅׅ׭דׅկ

  15. 5SBOTJUJPO׾ⵃ欽ׅ׷倯岀 ˖ 
 ֿ׸ָ㛇劤 ˖ 
 ٖ؎،ؐزך㢌刿ד荈⹛ד،صً٦ءّٝ׾אֽ׷ ˖ 
 4IBSFE&MFNFOU5SBOTJUJPO׮ֿ׸➙כֿ׸ָ㢳ְ

    ˖ 4DFOF׾⢪ֲ w 5SBOTJUJPO.BOBHFSCFHJO%FMBZFE5SBOTJUJPO w 8JOEPX5SBOTJUJPO
  16. 8JOEPX5SBOTJUJPO "1*-FWFM "OESPJE։  㛇劤כ珏겲 ˖ ׋׌ך8JOEPX5SBOTJUJPO
 "DUJWJUZך剑ⴱך朐䡾ַ׵ծ邌爙ׁ׸׋䖓ך朐䡾תד׾،صً٦ ءّٝ圫㶨 ➙㔐כⶴ䠥

     ˖ 
 ⵸ך"DUJWJUZַ׵Ⱏ鸐ך׮ך׾5SBOTJUJPOדֹ׷ w 4IBSFE&MFNFOU5SBOTJUJPO
  17. 4IBSFE&MFNFOU5SBOTJUJPO ɾࢦఆํ๏ ςʔϚʹΑΔࢦఆ <item name=“android:windowSharedElementEnterTransition">@transition/ shared_element</item> ίʔυʹΑΔࢦఆ activity.getWindow().setSharedElementEnterTransition(sharedEnter);

  18. 4IBSFE&MFNFOU5SBOTJUJPO ࣮૷ํ๏ৄࡉ

  19. None
  20. None
  21. 4IBSFE&MFNFOU5SBOTJUJPO ࣮૷ํ๏ৄࡉ

  22. 4IBSFE&MFNFOU5SBOTJUJPO ך➬穈׫  EFDPS7JFXOE/BNFE7JFXT TIBSFE&MFNFOUT דUSBOTJUJPO/BNFָאְ׋7JFX׾Ⰻג《׶⳿ׅ &OUFS5SBOTJUJPO$PPSEJOBUPS   植㖈ךٖ؎،ؐزך7JFXך⡘縧׾⥂㶷

    "DUJWJUZ5SBOTJUJPO$PPSEJOBUPS   "DUJWJUZ鼂獳ד床׏גֹ׋#VOEMFח״׶ծ⯋ךٖ؎،ؐزך⡘縧ד7JFXMBZPVU ׾ㄎן⳿ׅ "DUJWJUZ5SBOTJUJPO$PPSEJOBUPS   5SBOTJUJPO.BOBHFSCFHJO%FMBZFE5SBOTJUJPO ׾5SBOTJUJPO׾䭷㹀׃גㄎן⳿ׅ &OUFS5SBOTJUJPO$PPSEJOBUPS   ⯋ך⥂㶷׃גְֶ׋7JFXך⡘縧ד7JFXMBZPVU ׾ㄎן⳿ׅ "DUJWJUZ5SBOTJUJPO$PPSEJOBUPS 5SBOTJUJPO.BOBHFSCFH JO%FMBZFE5SBOTJUJPO TDFOF ભҠݩͷ7JFXͷҐஔ 0O1SF%SBX-JTUFOFS PO1SF%SBX WJFXMBZPVU MFGU  UPQ SJHIU CPUUPN TDFOF ભҠઌͷ7JFXͷҐஔ ࢦఆͨ͠5SBOTJUJPO WJFXMBZPVU MFGU  UPQ SJHIU CPUUPN [ݺ͹ΕͨଆͷActivityͷ಺෦ͷॲཧ(API Level 25ͷίʔυΑΓ)] ؒҧ͍ͬͯͨΒίϝϯτ͍ͩ͘͞
  23. ֿֿתדד⳿勻׷ֿה .BUFSJBM%FTJHOך$IPSFPHSBQIZ 䮶׶➰ֽ ָ 㹋鄲׃װֻׅז׷ ꟼ⤘䚍׾僇澗חׅ׷

  24. ֿֿתדד⳿勻׷ֿה <?xml version="1.0" encoding="utf-8"?> <transitionSet xmlns:android="http://schemas.android.com/apk/res/and xmlns:app="http://schemas.android.com/apk/res-auto" android:duration="375" android:interpolator="@android:interpolator/fast_out_slow_in"> <changeBounds

    /> <fade android:duration="150" android:startDelay="75"> <targets> <target android:targetName="all_content_element_nonshare_te </targets> </fade> </transitionSet> 5SBOTJUJPOʹམͱ͠ࠐΊΔ
  25. $VTUPN5SBOTJUJPO 044ך(PPHMF1MBJE،فٔ״׶ ˖ 歗꬗鼂獳儗ך5SBOTJUJPO ˖ 'MPBUJOH"DUJPO#VUUPOך5SBOTJUJPO ˖ 嗚稊璞ך5SBOTJUJPO ̔%SPJE,BJHJדֶ鑧׃תׅ ׋ע׿

  26. ⿫罋项俱 ˖ "OJNBUJOH7JFXT6TJOH4DFOFTBOE5SBOTJUJPOTIUUQTEFWFMPQFSBOESPJEDPNUSBJOJOH USBOTJUJPOTJOEFYIUNM ˖ %FW#ZUFIUUQTXXXZPVUVCFDPNXBUDI GFBUVSFQMBZFS@FNCFEEFEW4)O+2B% ˖ ⹛ַׅ %FW'FTU,BOTBJ

    IUUQZBSBLJHJUIVCJPTMJEFTEFWGFTULBOTBJ JOEFYIUNM ˖ 5SBOTJUJPOTJOUIF"OESPJE4VQQPSU-JCSBSZIUUQTNFEJVNDPNHPPHMFEFWFMPQFST USBOTJUJPOTJOUIFBOESPJETVQQPSUMJCSBSZCDBEFGFTVIE ˖ BOESPJEVJUPPMLJUEFNPTIUUQTHJUIVCDPNHPPHMFBOESPJEVJUPPMLJUEFNPT ˖ 4VQQPSU-JCSBSZGPS5SBOTJUJPOT0WFSWJFXBOEDPNQBSJTPOXJUI5SBOTJUJPOT&WFSZXIFSF IUUQTNFEJVNDPN!BOELVMJLPWTVQQPSUMJCSBSZGPSUSBOTJUJPOTPWFSWJFXBOE DPNQBSJTPODCFDGDCVED[ONVZ