Switching between different views via tab in the app is not a new concept for material design, they are equivalent to the top navigation mode of the home page or the content of different groups within the app (for example, different styles of music).
The Tablayout in the design package now has a fixed tab and a scrolling tab is implemented. For the former, the width of the view is divided between all tabs, and for the latter, the tab does not have a uniform size and can be scrolled horizontally. tab can be added by code:
Tablayout tablayout = ...; 2 Tablayout.addtab (Tablayout.newtab (). SetText (' Tab 1 '));
However, if you are using Viewpager to cross-tab between tabs, you can create tab directly from the Pageradapter Getpagetitle () method, and then use Setupwithviewpager () method to link viewpager and tab. This ensures that the tab check event is updated with Viewpager, and the tab update is selected.
Material Design (vii)--snackbar