Android View including ViewParent

We have seen the ViewParent from the getParent method, then we will go deep about this in this post

http://blog.csdn.net/guolin_blog/article/details/12921889

Firstly we should know how to get the LayoutInflater

And secondly, we should know that in order to enable the layout's size, we should create a outer layout to cover it, then the property of this layout can has some effect

after reading the previous example, then we should begin to study the underlying mechanism of the LayoutInflater

The previous content can use the following graph to illustrate

Then we will begin to study more about the View component

http://blog.csdn.net/guolin_blog/article/details/16330267

Firstly, we should study the view component's lifecycle.

We will begin with the onMeasure() method

So, going through such a complicated process, we will come to the final important function setMeasuredDimension() method to set the dimension we have speculated, but we also can set it directly through override the function.

then we will go to the onLayout phase

after determine the place (4 key point of the view) we should use the parent view to set up this view, so the actual logic of this method is completed in the viewgroup's onLayout method

but we need to implement it by ourselves, and although the functions seems to be separately, but they are closely related internally

and as a good android programmer, we should always set the measured value equals to the actual value

Finally, we will use the canvas to draw some component on the screen

Then we will go from the drawable's perspective to talk more about the view state and content related to the view-redraw

http://blog.csdn.net/guolin_blog/article/details/17045157

Firstly, we should get an overview of the view state

then the selector xml file can be used as the background

Then the principal in the behind is created through the callback mechanism

Then about the view – redraw, it is implemented using the invalidate function

To totally understand the view in android, in this section will create our own widget and import them in our layout file

http://blog.csdn.net/guolin_blog/article/details/17357967

Firstly we should know the category of the self-defined view component, it can be grouped into three parts

The following example, has demonstrated the usage of the invalidate() method

The most important logic is in the onDraw() function, in this function, we will have the basic view component created

Then we will use the toolbar to talk about the combinational widget in view part

and finally, we will begin to learn how to derive from the system's view widget

then we will set up my list view to support the swipe operation (the code can be found at the ever note page)

ONE OF THE IMPORTANT THING IS IN THE ADAPTER CLASS, WE CAN USE THE GETCONTEXT TO GET THE CONTEXT AND GET THE LAYOUTINLFATER OBJECT AS THE FIRST POST TALKS

The following code segment have used the notifydatachanged() function to update the listview

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s