Hi all, I have created an internal view which shou...
# android
r
Hi all, I have created an internal view which should only be used in the module where it is created, but I can see it in xml in the other module which has the dependency (It is hidden from kotlin but visible from XML). How Do I make it hidden from the other module’s xml as well?
a
You can't without implementing your own
LayoutInflater
to enforce the restriction.
LayoutInflater
will reflectively inflate anything available in the classloader.
convention is usually to put
internal
in the package name so that if someone does it anyway, it looks wrong. e.g.
com.example.mymodule.internal.MyView
r
just wondering if it works in way that I just have an internal class and I create a view from context and build the view from kotlin, do you think that would stop it form being visible?
c
I think you can make a public.txt to describe which resources you want public from an AAR
that's how the androidx aars mark resources as public I believe
r
But my issue is with actual custom kotlin class unlike the xml resources
c
I completely misunderstood what you asked, apologies
r
No problem, thanks for trying to help