DataBindingUtil.setContentView(this, R.layout.partial_question); throw view tag isn't correct on view:null
rkmax opened this issue · 4 comments
rkmax commented
I'm using databindings on my project when I use on a DraggerActivity
DataBindingUtil.setContentView(this, R.layout.my_layout);
instead
setContentView(R.layout.my_layout);
I got
Caused by: java.lang.RuntimeException: view tag isn't correct on view:null
rkmax commented
After a lot of trial and error what I did was copy the DraggerActivity source to and create my own DraggerActivity then add the following methods
private void configViews(View root) {
this.draggerPanel.addViewOnDrag(root);
if(this.shadowResID == -1) {
this.shadowResID = com.github.ppamorim.dragger.R.layout.layout_shadow;
}
this.draggerPanel.addViewOnShadow(this.inflateLayout(this.shadowResID));
super.setContentView(this.draggerPanel);
}
public void setContentView(View root) {
this.configDraggerView();
this.configViews(root);
super.setContentView(this.draggerPanel);
}
then on the onCreate method
View rootView = getLayoutInflater().inflate(R.layout.my_Layout, null, false);
mBinding = DataBindingUtil.bind(rootView);
setContentView(rootView);
in that way I get enable data bindings to my DraggerActivity
ppamorim commented
Oh, that's a good approach. Can you create a fork and a PR to merge these changes?
This library was created when the data binding wasn't popular/exists, then I don't tested with this feature. Sorry.
rkmax commented
Sure. right now I'm rushing, but very soon I'll send you a PR
mohameddawood commented
thanks it works fineeeeee