TabLayout provides a horizontal layout to display tabs.
Population of the tabs to display is done through TabLayout.Tab instances. You create tabs via newTab(). From there you can change the tab's label or icon via setText(int) and setIcon(int) respectively. To display the tab, you need to add it to the layout via one of the addTab(Tab) methods. For example:
TabLayout tabLayout = ...;
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
You should add a listener via addOnTabSelectedListener(OnTabSelectedListener) to be notified when any tab's selection state has been changed.
material design library-
implementation 'com.google.android.material:material:1.2.0-alpha06'
Смотрите видео Material design tab layout with viewpager and fragments онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Android Development Tutorials 19 Май 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 102 раз и оно понравилось 2 людям.