Skip to content

Commit 7cad365

Browse files
Material Design Teamdsn5ft
authored andcommitted
[M3][Docs] Update BadgeDrawable developer documentation
PiperOrigin-RevId: 399518697
1 parent 0b9c605 commit 7cad365

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/components/BadgeDrawable.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Badge | Badge with number
1616
![badge_icon](assets/badge/IconOnlyBadge.png) | ![badge_with_number_8](assets/badge/BadgeNumber.png) | ![badge_with_999+](assets/badge/BadgeNumberLongerThanMaxCharCount.png)
1717

1818
**Note:** This component is still under development and may not support the full
19-
range of customization Material Android components generally support (e.g.
20-
themed attributes).
19+
range of customization Material Android components generally support, for
20+
instance, themed attributes.
2121

2222
A `BadgeDrawable` represents dynamic information such as a number of pending
2323
requests in a [`BottomNavigationView`](BottomNavigation.md) or
@@ -34,19 +34,19 @@ requests in a [`BottomNavigationView`](BottomNavigation.md) or
3434
Create an instance of `BadgeDrawable` by calling `create(Context)` or
3535
`createFromAttributes(Context, AttributeSet, int, int)}`.
3636

37-
How to add and display a `BadgeDrawable` on top of its anchor view depends on
38-
the API level:
37+
The approach used to add and display a `BadgeDrawable` on top of its anchor view
38+
depends on the API level:
3939

4040
In API 18+ (APIs supported by
4141
[ViewOverlay](https://developer.android.com/reference/android/view/ViewOverlay))
4242

4343
1. Add `BadgeDrawable` as a
4444
[ViewOverlay](https://developer.android.com/reference/android/view/ViewOverlay)
4545
to the desired anchor view.
46-
1. Update the `BadgeDrawable`'s coordinates (center and bounds) based on its
46+
2. Update the `BadgeDrawable`'s coordinates (center and bounds) based on its
4747
anchor view using `#updateBadgeCoordinates(View)`.
4848

49-
Both of the above steps have been encapsulated in a util method:
49+
Both steps have been encapsulated in a util method:
5050

5151
```java
5252
BadgeUtils.attachBadgeDrawable(badgeDrawable, anchor);
@@ -56,11 +56,11 @@ In Pre API-18
5656

5757
1. Set `BadgeDrawable` as the foreground of the anchor view's `FrameLayout`
5858
ancestor.
59-
1. Update the `BadgeDrawable`'s coordinates (center and bounds) based on its
60-
anchor view (relative to its `FrameLayout` ancestor's coordinate space),
59+
2. Update the `BadgeDrawable`'s coordinates (center and bounds) based on its
60+
anchor view, relative to its `FrameLayout` ancestor's coordinate space.
6161

6262
Option 1: `BadgeDrawable` will dynamically create and wrap the anchor view in a
63-
`FrameLayout`, then insert the `FrameLayout` into the anchor view original
63+
`FrameLayout`, then insert the `FrameLayout` into the original anchor view
6464
position in the view hierarchy. Same syntax as API 18+
6565

6666
```java
@@ -76,17 +76,17 @@ can specify a `FrameLayout` to display the badge instead.
7676

7777
### `BadgeDrawable` Gravity Modes
7878

79-
`BadgeDrawable` provides 4 pre-packaged gravity modes that control how the badge
80-
aligns with respect to its anchor view. By default (`TOP_END`), badge aligns to
81-
the top and end edges of the anchor (with some offsets). The other options are
79+
`BadgeDrawable` provides four pre-packaged gravity modes that control how the
80+
badge aligns with its anchor view. By default (`TOP_END`) badge aligns with the
81+
top and end edges of the anchor (with some offsets). The other options are
8282
`TOP_START`, `BOTTOM_START` and `BOTTOM_END`.
8383

8484
### `BadgeDrawable` center offsets
8585

86-
By default, `BadgeDrawable` is aligned to the top and end edges of its anchor
86+
By default, `BadgeDrawable` is aligned with the top and end edges of its anchor
8787
view (with some offsets). Call `setBadgeGravity(int)` to change it to one of the
88-
other supported modes. To adjust the badge's offsets w.r.t. the anchor's center,
89-
use `setHoriziontalOffset(int)` or `setVerticalOffset(int)`
88+
other supported modes. To adjust the badge's offsets relative to the anchor's
89+
center, use `setHoriziontalOffset(int)` or `setVerticalOffset(int)`
9090

9191
### `BadgeDrawable` Attributes
9292

@@ -100,6 +100,6 @@ Badge Gravity | `app:badgeGravity`
100100
### Talkback Support
101101

102102
`BadgeDrawable` provides a getter for its content description, which is based on
103-
the number (if any) being displayed. Users should specify content description:
103+
the number (if any) displayed. Users should specify content description:
104104
`setContentDescriptionNumberless(CharSequence)`
105105
`setContentDescriptionQuantityStringsResource(@StringRes)`

0 commit comments

Comments
 (0)