TabLayout Android development of the uses detailed

Create a project

Detailed methods

Method name Parameter Description Function Description
void setSelectedTabIndicatorColor(@ColorInt int color) Incoming color values ​​corresponding to the available Color.parseColor ( "# 009AFF") parses Set the current selected tab tab indicator color
void setSelectedTabIndicatorHeight(int height) Unit px, dp need to be converted The height indicator provided
void setTabTextColors(int normalColor, int selectedColor) Incoming color values Set different states (normal, selected) for the tab text color
setTabMode(int mode) MODE_FIXED: Fixed tab displays all tabs at the same time, benefit from the most suitable for Quick fulcrum between tabs.
MODE_SCROLLABLE: scrollable tab displays a subset of the tabs at any given moment, and may include a longer tab label and a greater number of tabs. When no direct comparison tag label, they are best suited for browsing context touch interface. This mode is usually used in conjunction with ViewPager.
Settings tab behavior patterns
void setTabIndicatorFullWidth(boolean tabIndicatorFullWidth) true or false,default is true Is set at the bottom of the tab label indicates the line width of the full support of the current tab tab width, the width of the tab title indicator line width if you want to have, it can be set to false

Related Reading

Guess you like

Origin www.cnblogs.com/cnblogzaizai/p/11571905.html