Skip to content

Commit 8f026e6

Browse files
markweidsn5ft
markwei
authored andcommitted
Flesh out FAB doc examples.
PiperOrigin-RevId: 183143764
1 parent 8f26967 commit 8f026e6

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

docs/components/FloatingActionButton.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ widget in your layout:
5555
android:layout_width="wrap_content"
5656
android:layout_height="wrap_content"
5757
android:layout_gravity="bottom|right"
58-
android:layout_margin="16dp"/>
58+
android:layout_margin="16dp"
59+
app:srcCompat="@drawable/ic_plus_24"/>
5960

6061
</android.support.design.widget.CoordinatorLayout>
6162
```
@@ -71,14 +72,28 @@ covered by an [AppBarLayout](AppBarLayout.md) or
7172
The updated Material FloatingActionButton consists of updated elevation, ripple,
7273
and motion changes.
7374

74-
```java
75-
style="@/style/Widget.MaterialComponents.FloatingActionButton"
75+
```xml
76+
<android.support.design.widget.FloatingActionButton
77+
android:id="@+id/floating_action_button"
78+
style="@/style/Widget.MaterialComponents.FloatingActionButton"
79+
android:layout_width="wrap_content"
80+
android:layout_height="wrap_content"
81+
android:layout_gravity="bottom|right"
82+
android:layout_margin="16dp"
83+
app:srcCompat="@drawable/ic_plus_24"/>
7684
```
7785

7886
### Material Styles (Legacy)
7987

80-
```java
81-
style="@/style/Widget.Design.FloatingActionButton"
88+
```xml
89+
<android.support.design.widget.FloatingActionButton
90+
android:id="@+id/floating_action_button"
91+
style="@/style/Widget.Design.FloatingActionButton"
92+
android:layout_width="wrap_content"
93+
android:layout_height="wrap_content"
94+
android:layout_gravity="bottom|right"
95+
android:layout_margin="16dp"
96+
app:srcCompat="@drawable/ic_plus_24"/>
8297
```
8398

8499
### Attributes
@@ -109,7 +124,7 @@ FloatingActionButton floatingActionButton =
109124

110125
floatingActionButton.setOnClickListener(new OnClickListener() {
111126
@Override
112-
public void onClick(View v) {
127+
public void onClick(View view) {
113128
// Handle the click.
114129
}
115130
});

0 commit comments

Comments
 (0)