I have several custom UI elements that are to be used in several projects. Each project will use the same UI elements but have a different looking front end.
eg: Background images for button types will be different depending on the project.
How do I package the UI classes and resources in such a way so that projects can use them while being able to modify the look and feel?
The Android UI model is inherently customizable, offering the means of Android customization, testing, and the ability to create custom UI components in various ways: Inherit an existing component (i.e. TextView , ImageView , etc.), and add/override needed functionality.
If you're looking to build a library you might want to do some research before starting. In most cases, a custom component library is an overkill and you're much better off using ready-made UI components like the ones you can find within JavaScript frameworks such as Vue and React UI.
Use Android library project, that will be shared among multiple apps. Provide there default graphics. When you provide customized graphics in your app for particular file in res folder, it will be used instead of default graphics in library. This way you can replace needed graphics set while using same code base.
Info: https://developer.android.com/tools/projects/index.html#LibraryProjects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With