ViewPager2をちょっとさわってみよう

 ViewPager2をちょっとさわってみよう

2019/02/28 potatotips #59

90ec81078e4fd2b905f8ef0776887afa?s=128

Ryo Sakaguchi

February 28, 2019
Tweet

Transcript

  1. ©2019 Wantedly, Inc. 7JFX1BHFSΛͪΐͬͱ
 ͞ΘͬͯΈΑ͏ QPUBUPUJQT !XBLXBL 3ZP4BLBHVDIJ 2019.2.28 -

  2. ©2019 Wantedly, Inc. Ryo Sakaguchi • Wantedly, Inc - Wantedly

    People • Android/CI/CD/UI • Kotlin/Sake/Beer/Guitar… • Twitter/GitHub: @wakwak3125 • SW-7284-4903-0124
  3. ©2019 Wantedly, Inc.  7JFX1BHFS w 7JFX1BHFSʹ͍ͭͯ  7JFX1BHFS w

    7JFX1BHFSʹ͍ͭͯ  Ͳ͏มΘͬͨͷ͔ʁ w ಺෦࣮૷ w ΠϯλʔϑΣΠε w ศརʹͳΔ͜ͱࠓޙͳΓͦ͏ͳ͜ͱ ࠓ೔͸ͳ͢͜ͱ
  4. ©2019 Wantedly, Inc. ViewPager

  5. ©2019 Wantedly, Inc. εϫΠϓͰ੾Γସ͑Δը໘ w ΢ΥʔΫεϧʔͳͲͰΑ͘࢖ΘΕΔ w جຊతʹ͸ԣεΫϩʔϧͰϖʔδૹΓ͢ΔͨΊͷ΋ͷˠ w ࣮૷࣍ୈͰ͸ॎ΋͍͚Δ

    ViewPager
  6. ©2019 Wantedly, Inc. ViewPager1 layout.xml

  7. ©2019 Wantedly, Inc. ViewPager1 Adapter

  8. ©2019 Wantedly, Inc. ViewPager1 Fragment

  9. ©2019 Wantedly, Inc. ViewPager2

  10. ©2019 Wantedly, Inc. ViewPager2 layout.xml

  11. ©2019 Wantedly, Inc. ViewPager2 Adapter

  12. ©2019 Wantedly, Inc. ViewPager2 Fragment

  13. ©2019 Wantedly, Inc. ·͕͍͕ͪ͞͠

  14. ©2019 Wantedly, Inc. Ͳ͏มΘͬͨͷ͔ʁ

  15. ©2019 Wantedly, Inc.  7JFX1BH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૷͸-JOFBS-BZPVU.BOBHFSͷPSJFOUBUJPOࢦఆ  7JFX1BHFSͷόά͕࣏Δ w BEBQUFS΁ͷσʔλͷߋ৽௨஌͕͏·͘ಈ͍͍ͯͳ͍όά͕ࠓճ࣏͍ͬͯΔ Ͳ͏มΘͬͨͷ͔ʁ ศརʹͳΓͦ͏ͳ͜ͱ
  22. ©2019 Wantedly, Inc. ·ͩBMQIBͳͷͰະ࣮૷ͷػೳ͕ଟ͍ w P⒎TFUͷ਺ͷίϯτϩʔϧ w XJEUIIFJHIU͕ݻఆ w ͦ͏͡Όͳ͍ͱݱঢ়͸ྫ֎Λ౤͛ΔΑ͏ͳ࣮૷ʹͳ͍ͬͯΔ

    w ৄ͘͠͸ެࣜͷ3FMFBTF/PUF΁ w IUUQTEFWFMPQFSBOESPJEDPNKFUQBDLBOESPJEYSFMFBTFTWJFXQBHFS w ίʔυதʹ΋50%0͕ͨ͘͞Μ͋Δ ੍ݶࣄ߲
  23. ©2019 Wantedly, Inc.  7JFX1BHFS w 7JFX1BHFS͸7JFX1BHFSΛ3FDZDMFS7JFXʹΑͬͯஔ͖͔͑Α͏ͱ͢Δ΋ͷ w جຊతͳσʔλͷߋ৽ॲཧ͸3FDZDMFS7JFXͱಉ͡ߟ͑ํͰྑͦ͞͏ w

    ϕʔε͕3FDZDMFS7JFXͳͷͰɺݱঢ়ͷࢿ࢈Λ࢖͍ͬͯ͘͜ͱ͕Ͱ͖Δ͔΋͠Εͳ͍ w %J⒎6UJM΍*UFN%FDPSBUPSͳͲ w ݱঢ়ͷ"1*͸7JFX1BHFSͱ΄ͱΜͲಉ͡ͳͷͰɺࠓޙͷҠߦ΋ָʹͰ͖ͦ͏  ·ͩੜ·Εͨͯ w ·ͩ·ͩόά΍ະ࣮૷ͷػೳ͕ଟ͍ͷͰɺ͜Ε͔Βͱݴ͏ײ͡
 1SPEVDUJPOͰ࢖͏ͷ͸·ͩͪΐͬͱૣ͍ؾ͕͢Δ ·ͱΊ