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

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

Ryo Sakaguchi
February 28, 2019

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

2019/02/28 potatotips #59

Ryo Sakaguchi

February 28, 2019
Tweet

More Decks by Ryo Sakaguchi

Other Decks in Programming

Transcript

  1. ©2019 Wantedly, Inc.
    7JFX1BHFSΛͪΐͬͱ

    ͞ΘͬͯΈΑ͏
    QPUBUPUJQT
    !XBLXBL 3ZP4BLBHVDIJ

    2019.2.28 -

    View full-size slide

  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

    View full-size slide

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

    View full-size slide

  4. ©2019 Wantedly, Inc.
    ViewPager

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  7. ©2019 Wantedly, Inc.
    ViewPager1 Adapter

    View full-size slide

  8. ©2019 Wantedly, Inc.
    ViewPager1 Fragment

    View full-size slide

  9. ©2019 Wantedly, Inc.
    ViewPager2

    View full-size slide

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

    View full-size slide

  11. ©2019 Wantedly, Inc.
    ViewPager2 Adapter

    View full-size slide

  12. ©2019 Wantedly, Inc.
    ViewPager2 Fragment

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  15. ©2019 Wantedly, Inc.
    7JFX1BHFS
    w 3FDZDMFS7JFXΛ಺แ͢Δ7JFX(SPVQ
    w 4OBQ)FMQFSΛ࢖༻ͯ͠ϖʔδૹΓΛ࣮ݱ͍ͯ͠Δ
    w Ҏલ·Ͱ7JFX1BHFSʹ͍࣋ͬͯͨॲཧͷଟ͘Λ3FDZDMFS7JFXʹҕৡ͍ͯ͠Δ
    'SBHNFOU4UBUF"EBQUFS
    w 3FDZDMFS7JFX"EBQUFS'SBHNFOU7JFX)PMEFS
    w *NQMFNFOUT4UBUFGVM"EBQUFS
    w ϥΠϑαΠΫϧ͸3FDZDMFS7JFXͷͦΕʹ४͍ͯ͡Δ
    w TBWF4UBUFSFTUPSF4UBUF
    Ͳ͏มΘͬͨͷ͔ʁ ಺෦࣮૷ 1/2

    View full-size slide

  16. ©2019 Wantedly, Inc.
    PO7JFX"UUBDIFE5P8JOEPX
    'SBHNFOU4UBUF"EBQUFS

    View full-size slide

  17. ©2019 Wantedly, Inc.
    PO7JFX3FDZDMFE
    'SBHNFOU4UBUF"EBQUFS

    View full-size slide

  18. ©2019 Wantedly, Inc.
    PO'BJMFE5P3FDZDMF7JFX
    'SBHNFOU4UBUF"EBQUFS

    View full-size slide

  19. ©2019 Wantedly, Inc.
    PO#JOE7JFX)PMEFS
    'SBHNFOU4UBUF"EBQUFS

    View full-size slide

  20. ©2019 Wantedly, Inc.
    "EBQUFS
    w 'SBHNFOU4UBUF1BHFS"EBQUFS'SBHNFOU4UBUF"EBQUFS
    w 3FDZDMFS7JFX"EBQUFS1BHFS"EBQUFS
    1BHF$IBOHF$BMMCBDL
    w BEE0O1BHF$IBOHF-JTUFOFSSFHJTUFS0O1BHF$IBOHF$BMMCBDL
    Ͳ͏มΘͬͨͷ͔ʁ ΠϯλʔϑΣΠε

    View full-size slide

  21. ©2019 Wantedly, Inc.
    35-ϨΠΞ΢ταϙʔτ
    w 35-ݴޠΛબ୒͍ͯ͠Δ৔߹ɺεΫϩʔϧ͕ٯʹͳΔ
    w ͕ʹͳΔ
    ॎํ޲ͷϖʔδϯάͷαϙʔτ
    w BOESPJEPSJFOUBUJPOlWFSUJDBMzͰॎํ޲ΛࢦఆͰ͖Δ
    w ಺෦࣮૷͸-JOFBS-BZPVU.BOBHFSͷPSJFOUBUJPOࢦఆ
    7JFX1BHFSͷόά͕࣏Δ
    w BEBQUFS΁ͷσʔλͷߋ৽௨஌͕͏·͘ಈ͍͍ͯͳ͍όά͕ࠓճ࣏͍ͬͯΔ
    Ͳ͏มΘͬͨͷ͔ʁ ศརʹͳΓͦ͏ͳ͜ͱ

    View full-size slide

  22. ©2019 Wantedly, Inc.
    ·ͩBMQIBͳͷͰະ࣮૷ͷػೳ͕ଟ͍
    w P⒎TFUͷ਺ͷίϯτϩʔϧ
    w XJEUIIFJHIU͕ݻఆ
    w ͦ͏͡Όͳ͍ͱݱঢ়͸ྫ֎Λ౤͛ΔΑ͏ͳ࣮૷ʹͳ͍ͬͯΔ
    w ৄ͘͠͸ެࣜͷ3FMFBTF/PUF΁
    w IUUQTEFWFMPQFSBOESPJEDPNKFUQBDLBOESPJEYSFMFBTFTWJFXQBHFS
    w ίʔυதʹ΋50%0͕ͨ͘͞Μ͋Δ
    ੍ݶࣄ߲

    View full-size slide

  23. ©2019 Wantedly, Inc.
    7JFX1BHFS
    w 7JFX1BHFS͸7JFX1BHFSΛ3FDZDMFS7JFXʹΑͬͯஔ͖͔͑Α͏ͱ͢Δ΋ͷ
    w جຊతͳσʔλͷߋ৽ॲཧ͸3FDZDMFS7JFXͱಉ͡ߟ͑ํͰྑͦ͞͏
    w ϕʔε͕3FDZDMFS7JFXͳͷͰɺݱঢ়ͷࢿ࢈Λ࢖͍ͬͯ͘͜ͱ͕Ͱ͖Δ͔΋͠Εͳ͍
    w %J⒎6UJM΍*UFN%FDPSBUPSͳͲ
    w ݱঢ়ͷ"1*͸7JFX1BHFSͱ΄ͱΜͲಉ͡ͳͷͰɺࠓޙͷҠߦ΋ָʹͰ͖ͦ͏
    ·ͩੜ·Εͨͯ
    w ·ͩ·ͩόά΍ະ࣮૷ͷػೳ͕ଟ͍ͷͰɺ͜Ε͔Βͱݴ͏ײ͡

    1SPEVDUJPOͰ࢖͏ͷ͸·ͩͪΐͬͱૣ͍ؾ͕͢Δ
    ·ͱΊ

    View full-size slide