It is possible to include layout and other resources in an Android jar?

后端 未结 3 1730
無奈伤痛
無奈伤痛 2021-01-19 17:36

I\'m building a jar so that other developers can use the view I create in their Android applications. I\'m wondering if it is possible to use a layout resource in my jar so

3条回答
  •  一向
    一向 (楼主)
    2021-01-19 17:52

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

提交回复
热议问题