Can I turn on the layout and other resources in the Android bank?

I am creating a jar so that other developers can use the view that I create in my Android applications. I am wondering if it is possible to use the layout resource in my bank so that I can build the layout of my view or if I needed to create my view programmatically. Similarly, is it possible to include image resources in a jar file?

+4
source share
3 answers

No, currently not. Due to the way Android package packages are in apk, you cannot include them in the jar. However, you can still share the jar with other developers - they just have to manually insert the layout files.

+4
source

NO, you will not need to specify layout parameters in your code to make the jar useful.

+2
source

YES, you can precompile your xml layout files and put them in the assets / pack folder, and then pack them into your jar file, after which you can load them using XmlResourceParser and LayoutInflater. Other resource files, such as an image, can also be packaged in jar, like this.

+1
source

Source: https://habr.com/ru/post/1304540/


All Articles