Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an Android UI library that has a customisable front end

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?

like image 664
Brad Avatar asked Jul 13 '12 04:07

Brad


People also ask

Can you customize Android UI?

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.

Should I create my own component library?

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.


1 Answers

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

like image 167
Pointer Null Avatar answered Oct 07 '22 09:10

Pointer Null