Android Tutorial - VIEWPAGER2 - 2020 - P2: TabLayout & Fragments (Kotlin) - German

Published: 02 February 2020
on channel: CodingWithChris
6,449
102

In diesem Video möchte ich euch zeigen, wie ihr den ViewPager2 implementieren könnt, um Fragments hin und her zu wischen. Mit dem ViewPager2 könnt ihr die Fragments nicht nur horizontal swipen, sondern auch vertikal orientiert. Ich erstelle dazu vier unterschiedliche Fragments. Als Adapter kommt ihr der FragmentStateAdapter zum Einsatz. Dieser ist schnell und simpel zu implementieren, wie genau das ganze funktioniert, zeige ich euch in diesem Tutorial.

Viel Spaß!!


Hier wie versprochen, die Dependencies die ihr unbedingt vorher einfügen müsst: (Stand 02/2020)


// ViewPager2
implementation 'androidx.viewpager2:viewpager2:1.0.0'
// CardView
implementation 'androidx.cardview:cardview:1.0.0'
// Tablayout + other stuff...
implementation 'com.google.android.material:material:1.2.0-alpha01'

GitHub Project:
https://github.com/ChrisRoh92/ViewPag...

Wie im Video erwähnt hier noch die Links zu den angesprochenen anderen Videos von mir:

This is the easiest way to implement ViewPager2 with TabLayout in Kotlin - Part 1 (German/Deutsch)
   • Android Tutorial - VIEWPAGER2 - 2020 ...  

These Shortcuts will increase your productivity at Android Studio (Kotlin) - German/Deutsch
   • These Shortcuts will increase your pr...  

RecyclerView with OnItemClickListener (Part1):
   • Android - RecyclerView + OnItemClickL...  

Update RecyclerView with DiffUtils (Part2):
   • Android - Update RecyclerView with Di...  

Swipe to Delete RecyclerView Items (Part3):
   • Android - Swipe to Delete RecyclerVie...  

RecyclerView Item Animation Tutorial (Kotlin) - Part 4 (German/Deutsch)
   • Android RecyclerView Item Animation T...  




-------------------------------------------------------------------------------------------------------


In this video I want to show you how to implement the ViewPager2 to wipe fragments back and forth. With the ViewPager2 you can not only swip the fragments horizontally but also orient them vertically. I create four different fragments. The FragmentStateAdapter is used as an adapter. It is fast and easy to implement, how exactly it works, I show you in this tutorial.

Here as promised, the dependencies you have to insert before: (Status 02/2020)

// ViewPager2
implementation 'androidx.viewpager2:viewpager2:1.0.0'
// CardView
implementation 'androidx.cardview:cardview:1.0.0'
// Tablayout + other stuff...
implementation 'com.google.android.material:material:1.2.0-alpha01'

GitHub Project:
https://github.com/ChrisRoh92/ViewPag...

As mentioned in the video, here are the links to the other videos I mentioned:

This is the easiest way to implement ViewPager2 with TabLayout in Kotlin - Part 1 (German/Deutsch)
   • Android Tutorial - VIEWPAGER2 - 2020 ...  

These Shortcuts will increase your productivity at Android Studio (Kotlin) - German/Deutsch
   • These Shortcuts will increase your pr...  

RecyclerView with OnItemClickListener (Part1):
   • Android - RecyclerView + OnItemClickL...  

Update RecyclerView with DiffUtils (Part2):
   • Android - Update RecyclerView with Di...  

Swipe to Delete RecyclerView Items (Part3):
   • Android - Swipe to Delete RecyclerVie...  

RecyclerView Item Animation Tutorial (Kotlin) - Part 4 (German/Deutsch)
   • Android RecyclerView Item Animation T...  


Watch video Android Tutorial - VIEWPAGER2 - 2020 - P2: TabLayout & Fragments (Kotlin) - German online without registration, duration hours minute second in high quality. This video was added by user CodingWithChris 02 February 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,449 once and liked it 102 people.