2
를 해결할 수없는있는 CustomView
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<merge
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/customview_checkbox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="@string/checkbox_value_key"
android:text="My CheckBox"/>
....
</merge>
</layout>
있는 CustomView 인플레이션 (FrameLayout이 확장) :
view = DataBindingUtil.inflate((LayoutInflater) getContext().getSystemService(Context
.LAYOUT_INFLATER_SERVICE), R.layout.custom_view, this, true);
을
이 오류가 발생합니다.
Error:(46, 61) error: cannot find symbol method getResources()
생성 된 바인딩 클래스 : 조지 마운트에 따라
public ViewBodyPartsBinding(android.databinding.DataBindingComponent bindingComponent, View[] root) {
super(bindingComponent, root[0], 0);
final Object[] bindings = mapBindings(bindingComponent, root, 9, sIncludes, sViewsWithIds);
this.mboundView0 = (android.widget.ImageView) bindings[0];
this.mboundView0.setTag(null);
this.mboundView2 = (android.support.percent.PercentRelativeLayout) bindings[2];
this.mboundView2.setTag(null);
....
this.customviewCheckbox1 = (android.widget.CheckBox) bindings[1];
this.customviewCheckbox1.setTag(root.getResources().getString(<package>.R.string.checkbox_value_key));
....
setRootTag(root);
// listeners
invalidateAll();
}
나는 요소에 태그를 설정하지 않았습니다. 그러므로 imho가 작동해야합니다 –
cwiesner
CheckBox에 사용하는 태그 속성에 문제가있는 것 같습니다. 나 자신을 시도하고 검색 후이 http://stackoverflow.com/questions/31826201/android-data-binding-not-working-with-view-androidtag-property를 찾았습니다. – Raghunandan
George Mount이 (가) '또는 supplies 고정 된 태그 또는 리소스 문자열 '이라고합니다. 나는 그것이 작동해야한다고 가정하는 이유는 리소스 문자열을 사용하고 있습니다. – cwiesner