Dragger icon indicating copy to clipboard operation
Dragger copied to clipboard

DataBindingUtil.setContentView(this, R.layout.partial_question); throw view tag isn't correct on view:null

Open rkmax opened this issue 8 years ago • 4 comments

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 avatar Apr 27 '16 23:04 rkmax

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

rkmax avatar Apr 28 '16 12:04 rkmax

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.

ppamorim avatar Apr 28 '16 12:04 ppamorim

Sure. right now I'm rushing, but very soon I'll send you a PR

rkmax avatar Apr 28 '16 13:04 rkmax

thanks it works fineeeeee

mohameddawood avatar Feb 15 '18 19:02 mohameddawood