Prepared for a while, always wanted to write an event distribution of the article summed up, this knowledge point is too important.
An application of the layout is rich, there are textview,imageview,button and so on, these child view of the outer layer there are viewgroup, such as Relativelayout,linearlayout. As a developer, we think, when clicked on a button, how did the Android system make sure that I or
packages, and their child packages, and you can see that all the UI components of the Android app inherit the view class. The view class is the basic unit of the user interface representation on the Android platform, and some subclasses of view are collectively referred to as widgets (tools), providing a complete implementation of UI objects such as text input boxes and buttons.A view, which occupies a rec
Measure calculation process of View in Android
In Android, Veiw goes through three phases in sequence from memory to display on the UI: Traffic calculation-> Layout-> drawing, for details about the overall mechanism of View calculation, layout, and drawing, see the layout and Drawing Mechanism of View in Android. Volume is the basis of layout and drawing, so it
, there are also many attributes starting with layout that can be set, these are the container attributes. The following uses LinearLayout as an example. The experiment scenario is as follows:
1
Next, let's take a look at the layout attributes of LinearLayout, which are embodied in the LinearLayout. LayoutParams class.
The help document shows that its attributes are as follows:
XML Attributes
Attribute Name
Android:
, contains a richer content.Add:"Touch events consist of Action_down, Action_move, ACITON_UP, and one complete touch event, down and up are only one, and the Move has several, which can be 0. "Here is a fact that the up event is probably 0," he added.It's a lot more understandable that you're just doing a gesture to zoom in on the demo of Moving Pictures. For the Onintercepttouchevent event, its application scenario is reflected in many viewgroup with
Tags: github tle window remove line MoS CEP Pass source
3.1 Android Control architecture
Measurement of 3.2 view
Drawing of 3.3 view
Measurement of 3.4 ViewGroup
Drawing of 3.5 ViewGroup
3.6 Customizing View
3.6.1 to expand the existing space
3.6.2 Creating a composite control
3.6.3 rewrite view
This problem has plagued me for a week and is finally solved today,
Thanks http://stackoverflow.com/questions/9402970/android-viewpager-throwing-indexoutofbounds-exception-when-setting-current-item
The error message is as follows:
15:01:29 04-11. 092: E/androidruntime (607): Fatal exception: main04-11 15:01:29. 092: E/androidruntime (607): Java. lang. indexoutofboundsexception: Index = 3 COUNT = 204-11 15:01:29. 092: E/androidruntime (607): At
View event delivery for Android1. Basic knowledge(1) All touch events are encapsulated into Motionevent objects, including the position of the touch, the time, the history, and the first few fingers (multi-touch).(2) Event types are divided into Action_down, action_up, Action_move, Action_pointer_down, Action_pointer_up, Action_cancel, and each event is ACTION_ Down begins action_up end.(3) The handling of events includes three classes, namely, the transfer of--dispatchtouchevent () function, in
Several constructors for View
Several important methods of View
Custom View
Simple comprehension of view drawing
Categories for Custom View
Procedures for customizing view
Custom ViewGroup
Customizing the ViewGroup process
Thorough understanding of Measurespec three modes
Summary of issues
Master
Android configuration file (2) and android configuration file
We know that each module of the Android system provides very powerful functions (such as phones, power supplies, and settings). By using these functions, applications can be more powerful and flexible. However, using these functions is not unconditional, but requires some permissions. Next, we will beg
(). requestDisallowInterceptTouchEvent (true);). Once the child Layout View or ViewGroup receives the touch event and calls this method, the parent ViewGroup will no longer call its own onInterceptTouchEvent () method, getParent () again after the event is processed (). requestDisallowInterceptTouchEvent (false.
The Touch event transfer of this View is summarized. Remember these rules when using the View.
. In this case, some readers are not very clear. At the end of the article, an example is provided to illustrate the problem.[Java]Public View inflate (int resource, ViewGroup root, boolean attachToRoot)
Public View inflate (int resource, ViewGroup root, boolean attachToRoot)
The third parameter indicates that if the second parameter is not null, true is placed in the V
controls, which is generally a custom layout, you can use a class to inherit a layout. This layout contains multiple controls.
3. Create a new control from scratch. That is, the widget is drawn directly from the View and ViewGroup.
4. Don't forget that there is another useful
Android UI interfaces are composed of View, ViewGroup, and its derived classes. Base
resumable download 1Dagger
--------------------------------------------------------------------------------
EEventBus1. EventBus Usage Details (1) -- Preliminary use of EventBus2. EventBus for fast Android Development Series Communication3. You are out of Android EventBus if you have never heard of it.--------------------------------------------------------------------------------
FFragment-Fragment1. Comp
. The View class is a very important class. It also has a subclass ViewGroup, but the ViewGoup class is often used as the container of other components.
Another note is the relationship between the View and ViewGoup classes. The View class includes the ViewGoup class and the ViewGoup class also includes the View class:
How can we implement interface development in the android project? Generally, we can ach
class. All the classes that implement gesture slide return inherit from it and it will be OK. If you do not need gesture slide, you don't need to inherit it. Now, let's look at the BaseSwipeBackActivity source code file, because the code comments are more detailed, I directly paste the code here, the code is very simple
Package com. hhl. slidingmenuswipebackdemo; import android. OS. bundle; import android.
Viewgroup,requestdisallowintercepttouchevent is covered by the following code in ViewGroup: Public void requestdisallowintercepttouchevent(BooleanDisallowintercept) {if(Disallowintercept = = ((Mgroupflags flag_disallow_intercept)! =0)) {//We ' re already in the assume our ancestors is too return; }if(disallowintercept) {mgroupflags |= flag_disallow_intercept; }Else{mgroupflags = ~flag_disallow_i
This time we are going deep into viewgroup, understanding the work of viewgroup, and will explain more about the view of the relevant knowledge. In order to be flexible in the future use of custom space beatings a step closer to the foundation. Want to have like-minded friends to explore, deep inside Android, in-depth understanding of
Figure Description: Moving, backup after the launch of Android virtual machine appears
Solution to the problem of panic:could not open D:\java2\android\android-sdk-windows\.android\avd\test.ini
A few days ago, I am sorting some files, the previously installed on the Android
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.