For Folks using ViewBinding -- I have a question, ...
# android
s
For Folks using ViewBinding -- I have a question, I am not sure if this is a bug. We have been using ViewBinding and so far it looks good, however, for a scenario where I wanted to include layouts that reside in a different library(AAR) in my app's current layout, unfortunately my binding variable has no visibility of the views that are available within the included layout, is this a known issue or is there any other way?
l
Do you want to add your variable to the layout obtained from arr?
s
Yes, let's say my main layout is
activity_main.xml
, and in that, I have something like this.
Copy code
<include
  android:id="@+id/toolbar"
layout="@layout/layout_from_external_lib"
/>
Now in my activity, the
binding
variable has no visibility of the views that are within in this layout
layout_from_external_lib
l
most likely, you will need to specify those variables in your layout.xml and pass from the to the connected layout via the app attribute.
If it's not clear, I can throw off an example
s
That would be helpful, thanks!
an example i mean
l
main.txt,your_included_layout.txt
j
That is databinding, not viewbinding @Loboda Deni
l
sorry i didn't notice
s
Yeah, this was for ViewBinding.
j
I think you can do nothing, except you can fork the original library and enable viewBinding
s
The original library is an internal one, perhaps i can enable ViewBinding in that and try it out.
j
Ah, if it is yours, just enable viewBinding and it will generate the bindings inside the build folder of that module
💯 1