How to use data-binding with Fragment

后端 未结 14 1052
不思量自难忘°
不思量自难忘° 2020-11-29 16:48

I\'m trying to follow data-binding example from official google doc https://developer.android.com/tools/data-binding/guide.html

except that I\'m trying to apply data

14条回答
  •  庸人自扰
    2020-11-29 17:27

    One can simply retrieve view object as mentioned below

    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    
    View view = DataBindingUtil.inflate(inflater, R.layout.layout_file, container, false).getRoot();
    
    return view;
    
    }
    

提交回复
热议问题