user2580401
user2580401

Reputation: 1889

android - what is view hierarchy?

I'm studying android, of course I'm novice, I always read something like view hierarchy, so what exactly does this mean? what is view hierarchy? e.g.

// fragment's containing frame doesn't exist. The fragment // may still be created from its saved state, but there is // no reason to try to create its view hierarchy because it // won't be displayed. Note this is not needed -- we could // just run the code below, where we would create and return // the view hierarchy; it would just never be used.

http://developer.android.com/reference/android/app/Fragment.html

Upvotes: 11

Views: 9342

Answers (3)

Abderazak Amiar
Abderazak Amiar

Reputation: 808

https://i.sstatic.net/gN6AO.png Each view in a user interface represents a rectangular area of the display. A view is responsible for what is drawn in that rectangle and for responding to events that occur within that part of the screen (such as a touch event). A user interface screen is comprised of a view hierarchy with a root view positioned at the top of the tree and child views positioned on branches below. The child of a container view appears on top of its parent view and is constrained to appear within the bounds of the parent view’s display area. you can refer to this link : [ http://www.techotopia.com/index.php/Understanding_Android_Views,_View_Groups_and_Layouts_in_Android_Studio][1]

Upvotes: 1

kabuko
kabuko

Reputation: 36302

You'll want to read the docs on the View class, but essentially views can be children of certain other views. You can nest views in complicated ways. This whole structure of views is referred to as the view hierarchy.

Upvotes: 5

Androiderson
Androiderson

Reputation: 17083

A View inside another View creates an hierarchy, the outer view becomes the parent of the inner view and the inner view is its child. It's just nested views.

Here's an example:

enter image description here

Upvotes: 17

Related Questions