Reusable Android Layouts

I was wondering how everyone reuses Android layouts and components. Are you making an old copy / pasting existing code into the project or is there a way to include layouts and components in the jar file for reuse?

EDIT: For example, if I have a list view, maybe I have a different view that I use for each list item in the list, it may have an icon, or there may be a title bar and then a line with more details. Although it’s not easy to create, it would be nice to create it once a whole and reuse it in different projects.

+4
source share
1 answer

If you use layouts in one project, the include tag will work:

<include android:id="@+id/the_id" layout="@layout/my_layout_to_include" /> 

for more information: http://www.curious-creature.org/

Regarding reuse in different projects, I would suggest creating a custom view and distributing it in a jar file.

+2
source

All Articles