android setText does not take effect problem

1. Tell me the solution directly:

If there is no problem with the code, just change the ID of your TextView and then restart the compiler ( note that restarting alone will have no effect without changing the ID of TextView! )

2. The process of problem occurrence:

There is a new requirement for the product. Since the interface is not much different, I directly copied the previous interface and modified the xml file name. Use DataBind for binding and assign a value to the TextView in LiveData. No matter how the assignment is performed, it will not take effect.

Using debug, it is found that the code has been run, but the interface has not changed. However, the TextView that DataBind can point to does not interrupt the interface rendering without any exception when rendering the interface. I have cleared Android Studio's cache several times, but it still does not work.

So I tried to change the ID of TextView, and the test found that the code ran normally, but other Views that did not change the ID still did not work (but the DataBind can still point to the correct View). This may be a bug of androidStudio...

Guess you like

Origin blog.csdn.net/qq_42111674/article/details/135225297