Difference between View and ViewGroup in Android

后端 未结 11 1520
暖寄归人
暖寄归人 2020-12-02 08:11

What is the difference between a View and a ViewGroup in Android programming?

11条回答
  •  广开言路
    2020-12-02 08:59

    ViewGroup is itself a View that works as a container for other views. It extends the functionality of View class in order to provide efficient ways to layout the child views.

    For example, LinearLayout is a ViewGroup that lets you define the orientation in which you want child views to be laid, that's all you need to do and LinearLayout will take care of the rest.

提交回复
热议问题