Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

What is the fundamental difference between them?

like image 612
Sanyam Jain Avatar asked Sep 20 '15 09:09

Sanyam Jain


People also ask

What is the difference between layout and container?

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.

What is the difference between layout and view in Android?

A layout defines the structure for a user interface in your app, such as in an activity. All elements in the layout are built using a hierarchy of View and ViewGroup objects. A View usually draws something the user can see and interact with.

What is the layout of Android?

Android Layout is used to define the user interface that holds the UI controls or widgets that will appear on the screen of an android application or activity screen. Generally, every application is a combination of View and ViewGroup.

Which file contains the containers used in Android?

To make an APK file, a program for Android is first compiled using a tool such as Android Studio or Visual Studio and then all of its parts are packaged into one container file. An APK file contains all of a program's code (such as .dex files), resources, assets, certificates, and manifest file.


1 Answers

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.
like image 190
sergej shafarenka Avatar answered Sep 28 '22 00:09

sergej shafarenka