英文:
Add Custom Attributes to Existing View
问题
我使用AndroidPlot已有一段时间,并发现有几个设置无法通过xml设置。现在在尝试使用BindingAdapter时,我创建了一些方法来扩展仅以编程方式提供的自定义现有属性。现在我的问题是,我必须将某些内容绑定到属性以使其生效。
因此,我有两个问题:
- 是否可以像使用BindingAdapters将xml属性添加到视图中一样做类似的操作?
- 或者是否可以强制 Android 在 OneTimeBinding 时使用 BindingAdapter?
谢谢。
英文:
I am using AndroidPlot since a while and found out that their are serveral settings, that cannot be set using xml.
Now during playing around with BindingAdapter, I created some Methodes to extend existing attributes with custom which are only provided Programmically.
Now my problem is that I have to bind something to the attributes in order to take effect.
So I have two questions:
- Is it possible to add xml-Attributes, using something simular
like BindingAdapters to Views. - Or is it possible to force android to use the BindingAdapter for OneTimeBinding?
Thanks
答案1
得分: 0
我使用了ViewModel来解决这个图表问题,这样我可以使用TDD来额外检查状态,并且可以使用BindingAdapter来添加一些XML属性。
英文:
I solved it using a ViewModel for the Diagramm, so I can check the States additionally using TDD and can use the BindingAdapter to add some xml Attributes.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论