Importing a custom view in Android Studio

2019-06-04 22:18发布

问题:

I've seen plenty of links that tell me how to create a custom view, but how how do you import an already existing one. I downloaded one and it looks like a whole project. How is it implemented into another project?

回答1:

  1. Import it as a module via File -> Import Module
  2. Add as a dependency to your project. File -> Project Structure -> Your Module -> Dependencies Tab -> Add -> Module Dependency.
  3. Include in your settings.gradle via include ':module name'
  4. Clean & Build