46.2 An Overview of the TabLayout Component
As previously discussed, TabLayout is one of the components introduced as part of material design and is included in the design support library. The purpose of the TabLayout is to present the user with a row of tabs which can be selected to display different pages to the user. The tabs can be fixed or scrollable, whereby the user can swipe left or right to view more tabs than will currently fit on the display. The information displayed on a tab can be text-based, an image or a combination of text and images. Figure 46-1, for example, shows the tab bar for an app consisting of four tabs displaying images:
Figure 46-1
Figure 46-2, on the other hand, shows a TabLayout configuration consisting of four tabs displaying text in a scrollable configuration:
Figure 46-2
The remainder of this chapter will work through the creation of an example project that demonstrates the use of the TabLayout component together with a ViewPager2...