3434
3535A
3636[ ` TabLayout ` ] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/tabs/TabLayout.java )
37- can be added to a layout like so :
37+ can be added to a layout:
3838
3939``` xml
4040<com .google.android.material.tabs.TabLayout
@@ -70,7 +70,7 @@ can then be added as children of the `TabLayout` and adjusted as needed:
7070</com .google.android.material.tabs.TabLayout>
7171```
7272
73- Changes to tab selection can be observed like so :
73+ Observe changes to tab selections :
7474
7575``` kt
7676tabLayout.addOnTabSelectedListener(object : TabLayout .OnTabSelectedListener {
@@ -92,12 +92,12 @@ tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
9292### Making tabs accessible
9393
9494The Android tab components support screen reader descriptions for tabs and
95- badges . While optional, we strongly encourage their use.
95+ badges. While optional, we strongly encourage their use.
9696
9797#### Content descriptions
9898
9999Adding a content description to the entire ` TabLayout ` can be done in XML with
100- the ` android:contentDescription ` attribute or programmatically like so :
100+ the ` android:contentDescription ` attribute or programmatically:
101101
102102``` kt
103103tabLayout.contentDescription = contentDescription
@@ -122,17 +122,17 @@ badge.setContentDescriptionExceedsMaxBadgeNumberStringResource(R.string.content_
122122
123123### Using tabs with ViewPager
124124
125- A ` TabLayout ` can be setup with a
125+ A ` TabLayout ` can be set up with a
126126[ ` ViewPager ` ] ( https://developer.android.com/reference/kotlin/androidx/viewpager/widget/ViewPager )
127127in order to:
128128
129129* Dynamically create ` TabItem ` s based on the number of pages, their titles,
130130 etc.
131131* Synchronize the selected tab and tab indicator position with page swipes
132132
133- Firstly , your
133+ First , your
134134[ ` PagerAdapter ` ] ( https://developer.android.com/reference/androidx/viewpager/widget/PagerAdapter )
135- (or subclass) needs to overrride the ` getPageTitle ` function in order to set the
135+ (or subclass) needs to override the ` getPageTitle ` function in order to set the
136136tab text label:
137137
138138``` kt
@@ -146,8 +146,7 @@ class Adapter : PagerAdapter() {
146146}
147147```
148148
149- After the adapter has been set on the ` ViewPager ` , synchronize the ` TabLayout `
150- like so:
149+ After the adapter has been set on the ` ViewPager ` , synchronize the ` TabLayout ` :
151150
152151``` kt
153152tabLayout.setupWithViewPager(viewPager)
412411## Theming tabs
413412
414413Tabs support
415- [ Material Theming] ( https://material.io/components/app-bars-bottom/#theming ) and
416- can be customized in terms of color and typography.
414+ [ Material Theming] ( https://material.io/components/app-bars-bottom/#theming )
415+ which can customize color and typography.
417416
418417### Tabs theming example
419418
@@ -433,8 +432,8 @@ dark pink, the unselected text is grey.](assets/tabs/tabs_theming.png)
433432
434433#### Implementing tabs theming
435434
436- Using theme attributes and styles in ` res/values/styles.xml ` (themes all tabs
437- and affects other components) :
435+ Use theme attributes and styles in ` res/values/styles.xml ` which applies to all
436+ tabs and affects other components:
438437
439438``` xml
440439<style name =" Theme.App" parent =" Theme.Material3.*" >
@@ -451,8 +450,8 @@ and affects other components):
451450</style >
452451```
453452
454- or using default style theme attributes, styles and theme overlays (themes all
455- tabs but does not affect other components) :
453+ Use default style theme attributes, styles and theme overlays, which apply to
454+ all tabs but do not affect other components:
456455
457456``` xml
458457<style name =" Theme.App" parent =" Theme.Material3.*" >
@@ -472,7 +471,7 @@ tabs but does not affect other components):
472471</style >
473472```
474473
475- or using the style in the layout ( affects only these tabs) :
474+ Use the style in the layout, which affects only these tabs:
476475
477476``` xml
478477<com .google.android.material.tabs.TabLayout
0 commit comments