The view class is the parent of viewgroup, and ViewGroup has all the properties of the VIEW. ViewGroup is primarily used as a container for VIEW. Take the view as your own child and manage it. Of course the child can also be a viewgroup type.The
Custom Controls --- inherit the ViewGroup class method (step 1 step by step effect ---- drag the image left and right + automatic rebound effect)
----------------------- The following effect is only the second step of the overall effect-(currently, drag the image left and right + the rebound effect) --- continue to update the blog -------------------------
Configuration File
Activity_main.xml (not explained, there is only one custom control)
[Html]
Control of Android layout filesWhat the layout file does: Controls the display location of each control you want to display on the screen view and ViewGroup:Most of the system classes in Android are sub-classes of view, which can be collectively referred to as Android controls that have a special subclass of ViewGroup
Under normal circumstances, we will rewrite the ondraw method of linearlayout and it will not be called. This article will analyze the causes and solutions.I. symptom
Android: Id = "@ + ID/ll_absolute"
Android: Orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
. The following Demo is used as an example.
The following control button can control the movement of the above View.
ScrollBy is a View method, which is an underlying method. Therefore, all the elements we see in Android have this method. What is this method for? The scrollBy method makes the View move a whole distance. For example, there is a viewGroup with many sub-views. If you want to change the positi
This problem should have been analyzed at the beginning when analyzing touch event processing. However, I thought this code was not so close to touch's topic at the time,
I ignored it until I encountered a problem on it. In fact, Android development should have encountered this phenomenon more or less. I am in our own app.
I also found this phenomenon. I was puzzled at the beginning, because according to my own research and analysis, only when a view
When you click ViewGroup, its sub-controls also become pressed. The Cause Analysis and Solution are as follows: viewgrouppressed
This problem should have been analyzed at the beginning when analyzing touch event processing. However, I thought this code was not so close to touch's topic at the time,
I ignored it until I encountered a problem on it. In fact, Android development should have encountered this ph
View class
1. The Android. View class is the most basic UI class. Many UI components on Android inherit this class.
2. These UI components include buttons, textview, and checkbox.
3. How should these UI components be placed?Viewgroup class
1. The preceding UI component is placed in a special view container, which is the viewg
First of all, I've been searching the internet for a long time and I haven't found a way to explain it, so I tried to write it myself.1. I have customized a viewgroup that inherits Relativelayout.The Java code is as follows:/*** Simple Custom three Avatar *@authorm.z*/ Public classMygroupheaderimgextendsRelativelayout { Publicmygroupheaderimg (Context context, AttributeSet attrs) {Super(context, attrs); This. Mcontext =context; MView= Inflate (contex
In Android, the layout is directly or indirectly inherited from the viewgroup class. The direct subclasses of viewgroup currently include:Absolutelayout, adapterview Among them, drawerlayout, pagertitlestrip, scyclingpanelayout, and viewpager are supported by Android API level 4 (version 1.6) and later
When inheriting the ViewGroup class, you must override two methods: onMeasure and onLayout.
1. Call the setMeasuredDimension method in onMeasure.
Void android. view. View. setMeasuredDimension (int measuredWidth, int measuredHeight)
In onMeasure (int, int), you must call setMeasuredDimension (int width, int height) to store the width and height of the measurement. If you do not do so, an exception Illega
During development, there are sometimes some requirements. Simply using the layout and controls provided by the system does not meet our development needs. Therefore, you can customize the layout (viewgroup) by yourself) and controls (view. Here, I will use a simple example to explain the basic process of custom viewgroup, hoping to help those who do not know the process.
First, we want to implement the fol
In development, there are some requirements that can sometimes be met. The layout and control system not only provides the use to meet our development, so this time on the line, usually your own custom layout (ViewGroup) and control (View) that. I am here, we will use a simple example, when they explain their definition viewgroup basic flow, I hope to help friends do not understand the process.First, we wan
One view: the rendering process of viewgroupViewgroup painting involves two steps: 1. Measure 2. LayoutCall the callback function in these two steps: 1. onmeasure () 2. onlayout ()1. onmeasure () in this function, viewgroup will accept the size of the childview request, and store it in childview through the measure (newwidthmeasurespec, heightmeasurespec) function of childview, so that getmeasuredwidth () of childview ()The value of andgetmeasuredheig
There are three important ways to inherit ViewGroup , so let's take a look at the following:1.onlayout methodprotectedvoidOnLayout (BooleanChangedintLeftintTopintRightintBottom) {}When we inherit ViewGroup , we will provide this method in addition to the constructor, and we can see that the method is defined in the source code of ViewGroup , that is, the parent c
Question: How does the system know if the user is sliding a (the page in the black box) or B (the FGM in the red box)Answer:-dispatchtouchevent, Onintercepttouchevent, ontoucheventProblem Resolution:This can be said to be an Android event handling problem, first introduce the great God said these three events "Each view subclass in the Android system has the following three methods that are closely related
1, ViewGroup can add the control, you can also use Once a few parts of the space are found to inherit ViewGroup, then rewrite the Onmeasure method, measure all the children inside, and then rewrite the layout method to lay out the location of the children's view.2 understand the principle of groupview, and according to the source code simulation when leaving the screen when the screen back to the homepage
The View class is the parent class of ViewGroup. ViewGroup has all the features of View. ViewGroup is mainly used to act as the View container and manage the View as its own child, of course, the child can also be of the ViewGroup type. The View class is generally used for drawing operations. It overrides its onDraw me
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.