The Kotlin Android Fragments introduction describes how to create Android Fragments and switch between them using Navigation Drawer, View Pager, ToolBar and BottomNavigationView.
All of the Android development tutorials will be written in the Kotlin programming language.
Each episode will be released on a weekly basis. Though there is the option of getting access to all the episodes straight away by buying the 5 episode series for $10.00
Create Fragment
In the first Kotlin on Android episode of the series, we create the Android project.
And then go through the steps of creating an Android Fragment along with its xml layout file.
The Andriod Fragment will be downloading & displaying an image. To help with this we will be using the Glide v4 Image Library from this tutorial.
Switching Fragments
The intention of this Kotlin on Android episode is describe how Android Fragment Transactions are used to replace one Fragment with another.
In the UI we will be adding an Android Menu. And using that Menu to switch between Android Fragments using the Fragment Manager’s FragmentTransaction method.
Navgiation Drawer
One popular mechanism for switching between Android Fragments is to implement an Android Navigation Drawer.
When the user swipes from left to right, a sidebar will partially occupy the screen with a list of items. In this example, the items will be from the Android Menu.
ToolBar
The current Android ActionBar which comes prebuilt with the Android project is not linked with the Android Navigation Drawer.
This Kotlin on Android development tutorial describes how to add an Android ToolBar. Then how to itegrate it with the Android Navigation Drawer.
ViewPager
The Android ViewPager Kotlin on Android development tutorial describes how to add an Android ViewPager.
Which will allow the user to swipe between Android Fragments.
This Kotlin on Android tutorial also describes how to integrate the Android ViewPager with the Android Navigation Drawer.
BottomNavigationView
The BottomNavigationView Kotlin on Android development tutorial describes how to implement the BottomNavigationView. Therefore allowing the Android application Fragments to be replaced by the BottomNavigationView’s item buttons.
This Kotlin tutorial also explains how to update the BottomNavigationView’s items when using the BottomNavigationView with the Android Navigation Drawer and ViewPager.