简体   繁体   中英

How to include an XML Layout into an Android library

Basically I am trying to make an Android library which needs to have an XML Layout.

But the problem I am facing is that I cannot see an Layout Folder under my res folder.

Till now I have figured out that a custom view can be made and used using a Java Class, but I am not in an favour of using this method as I am not very knowledgeable in making layouts using java.

My research till now has given me an Idea that Is it possible for my Library class to accept an layout and the ids of views inside the layout and then use them as needed.

OR

Is there any other way of doing it?

Any Help would be really appreciated.

But the problem I am facing is that I cannot see an Layout Folder under my res folder.

You are welcome to create a res/layout/ directory yourself. There are an infinite number of resource directories; few will be created for you when you create your project.

You can use the file manager that is part of your desktop OS to create this directory. Or, from Android Studio, you can right-click over the res/ directory, choose New > Directory from the context menu, and enter layout for the name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM