Is there any possible way to share layout(part) between activities? For example, in my app, all activities have similar layout, the top part is long operation indicator (a progr
You could use include
in XML
to, well.. include the re-useable part of your layout code.
As an example, here's my layout file for the Toolbar
I used in my app:
// /res/layout/component_toolbar.xml
Now, say if I want to use that Toolbar
again in a different Activity
, this is all I'd have to write:
// /res/layout/whatever_layout_this_might_be.xml
Bear in mind that this would only copy the layout - not the actual behavior of said widget/component.
If you want to actually copy all of the aspects (layout, behaviour) I'm afraid Fragment
is the only way to go.