What is the difference between a layout and a container in Android?

后端 未结 3 2153
温柔的废话
温柔的废话 2021-02-12 14:31

In android studio, in design section, Layouts and Containers are categorized separately.

What is the fundamental difference between them?

3条回答
  •  爱一瞬间的悲伤
    2021-02-12 15:00

    I would define the differences as follows:

    • Layouts are general-purpose ViewGroups dealing directly with graphical views. They have no requirements on what kind of children they can manage.
    • Containers fulfill more specific tasks, that's why they have additional requirements on how many and which kind of children they can accept. Because of that most containers require writing Adapter classes in order to express those requirements.

提交回复
热议问题