material-components / material-components/material-components-android

Data Binding Can't Update Text On ExtendedFloatingActionButton Immediately

Open
#3,226 1 comment 0 reactions 1 assignee View on GitHub

@imhappi is already working on this.

Since Feb 9, 2023.

bug Widget: FloatingActionButton
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:
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.