material-components / material-components/material-components-android
Data Binding Can't Update Text On ExtendedFloatingActionButton Immediately
@imhappi is already working on this.
Since Feb 9, 2023.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Description: I used data binding for display text on ExtendedFloatingActionButton , but it didn't update text, then i tried edit text, textview, ... for sure my code didn't wrong. And yes, other view can display data from view model state flow. Data on ExtendedFloatingActionButton just show when I recreated Fragment or Activity
Expected behavior:

Source code:
Code for data binding on ExtendedFloatingActionButton :
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/copyIdRoomBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:onClick="@{(v)->setClick.onClick(v)}"
android:text="@{mainVM.saveCurrentRoomClicked.data != null ? @string/id_room(mainVM.saveCurrentRoomClicked.data._idRoom) : @string/empty_string}"
app:elevation="0dp"
app:icon="@drawable/ic_copy" />
Minimal sample app repro:
Android API version: Min is 26 and Max is 33
Material Library version: 1.9.0-alpha01
Device: Poco x3 Pro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.