How to share common layout between activities without fragment

后端 未结 3 1397
挽巷
挽巷 2021-02-02 18:11

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

3条回答
  •  無奈伤痛
    2021-02-02 18:59

    Although ActivityGroup is deprecated fro API 13 but if you don't wish to go with fragments then this can be your best choice.

    According to documentation, an ActivityGroup is:

    A screen that contains and runs multiple embedded activities.

    You can find a tutorial here and here Although the mentioned tutorial uses a Tablayout you can replace that with your common layout in XML.

    A second Approach could be Reuse the layout with include tag, in this approach you could just reuse your once created common layout everywhere in the app.

提交回复
热议问题