android– 生成的数据绑定类有两个同名的方法,导致错误

android– 生成的数据绑定类有两个同名的方法,导致错误,第1张

概述我有两个名为“attribute_short”和“attribute_long”的属性.我的吸气鬼和二传手.@BindablepublicfloatgetAttribute_long(){returnattribute_long;}publicvoidsetPricePerBoxSingle_long(floatattribute_long){this.attribute_long

我有两个名为“attribute_short”和“attribute_long”的属性.

我的吸气鬼和二传手.

@Bindable    public float getAttribute_long() {        return attribute_long;    }    public voID setPricePerBoxSingle_long(float attribute_long) {        this.attribute_long= attribute_long;        notifyPropertyChanged(com.foo.bar.baz.BR.attribute_long);    }@Bindable    public float getAttribute_short() {        return attribute_short;    }    public voID setPricePerBoxSingle_short(float attribute_short) {        this.attribute_short= attribute_short;                    notifyPropertyChanged(com.foo.bar.baz.BR.attribute_short);    }

还有两个编辑文本:

<EditText    androID:ID="@+ID/attributeinput_short"    ...    androID:text="@={values.attribute_short}" /><EditText    androID:ID="@+ID/attributeinput_long"    ...    androID:text="@={values.attribute_long}" />

在生成的数据绑定类中,碰巧有两个具有相同名的方法,这会导致错误.

private androID.databinding.InverseBindingListener attributeInpu = new androID.databinding.InverseBindingListener() {        @OverrIDe        public voID onChange() {            float callbackArg_0 = com.sample.Values.getText(attributeinput_short);...private androID.databinding.InverseBindingListener attributeInpu = new androID.databinding.InverseBindingListener() {            @OverrIDe            public voID onChange() {                float callbackArg_0 = com.sample.Values.getText(attributeinput_long);...

错误:

Error:(196, 56) error: variable attributeInpu is already defined in class FragmentinputBinding

如何解决这个重复生成的方法名称问题?

解决方法:

恕我直言,这可能与此报道的问题有关:http://code.google.com/p/android/issues/detail?id=212492

总结

以上是内存溢出为你收集整理的android – 生成的数据绑定类有两个同名的方法,导致错误全部内容,希望文章能够帮你解决android – 生成的数据绑定类有两个同名的方法,导致错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1108317.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存