任何人都可以帮助我以正确的方式更改TextView's text in MotionLayout... 这就是我正在做的事情。
我正在MotionLayout一个简单的应用程序上测试...我到达了关于Motion 教程的部分CustomAttributes
有了它们,您可以更改BackgroundColora 的View,也可以更改textColorusingcustomColorValue
在这种情况下,您可以看到它在开始和结束场景中更改此值非常有效:
<CustomAttribute
motion:attributeName="backgroundColor"
motion:customColorValue="#004A6D" />
<CustomAttribute
motion:attributeName="textColor"
motion:customColorValue="#000000" />
另外我注意到有一个customStringValue所以我想我可以将TextView文本更改为“之前”->“之后”。但是当我尝试用CustomAttribute应用程序崩溃来设置它时。
在开始场景中:
<CustomAttribute
motion:attributeName="Text"
motion:customStringValue="BEFORE" />
在最后一幕:
<CustomAttribute
motion:attributeName="Text"
motion:customStringValue="AFTER" />
在 MotionScene 之外,textView文本为TEST:
- 当我
CustomAttribute为结束场景设置唯一时......文本从初始值TEST更改为结束AFTER值......所以它部分工作但永远不会返回到初始状态。 - 这也发生在没有设置初始文本时
TextView。它部分工作。
TextView所以......任何人都可以帮助我以正确的方式更改MotionLayout.


