);int height;int tempHeight=lp.height;if (tempHeight > 0) {height = MeasureSpec.makeMeasureSpec(tempHeight,MeasureSpec.EXACTLY);} else {height = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);}view.measure(width, height);}
5. if the hiding succeeds, we need to implement the specific functions below. pull-down refresh, release refresh, and refresh the three statuses. The status is changed through gestures. So here we need to implement onTouch, and of course there is OnScrollListener.
Y
scenario for storing hierarchical data.Here is some data to show the hierarchical structure data in the comment table. Sample table: Picture Description Storage Structure: Analysis of the optimal absence of adjacency tableFor the adjacency table above, many programmers have used it as a default solution, but even so, it still has problems in the past.Analysis 1: Query all descendants of a node (seeking subtree) How to check?Let's take a look at t
Use javascript to obtain the cursor position on the page and the object that triggers the event. use javascript to obtain the cursor position:
The Code is as follows:
Function mousePosition (ev ){If (ev. pageX | ev. pageY ){Return {X: ev. pageX,Y: ev. pageY};}Return {X:
This article introduces how to use JS to obtain mouse coordinates. If you need it, refer to it.
The Code is as follows:
Var restrictX;Var restrictY;Var tip;// Mouse coordinatesFunction mousePosition (ev ){Return {X: ev. clientX + document.doc umentElement. scrollLeft-document.doc umentElement. clientLeft,Y: ev. clientY + document.doc umentElement. scrollTop-doc
Native javascript compatibility: currentStyle, scrollTop, event, and bound event IE binding events are attachEventdetachEvent compatibility test instances. If you are interested, refer to section 1. get the width, border color and other css (not line) in the style table is mainly IE6-7 support currentStyle, standard browser support getComputedStyle;
Instance: encapsulation Function
The Code is as follows:
Function getStyle (obj, name ){If (obj. currentStyle ){Return obj. currentStyle [name];
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2444
Question:
Yes N Students, including M People know each other. Each person can be assigned a room and asked if they can N The students are divided into two parts. The students in each part do not know each other, but the students in the two parts do not know each other. If it can be divided into two parts, the maximum number of rooms is calculated; otherwise, the output is No .
Analysis:
First, determine whether i
Use JavaScript to get the mouse position:
CopyCode The Code is as follows: function mouseposition (EV ){
If (EV. pagex | eV. Pagey ){
Return {
X: eV. pagex,
Y: eV. Pagey};}Return {X: eV. clientx + document. Body. scrollleft-d
"){
Public void run (){
// Call in a loop: readevent (EV );...Send = preprocessevent (Di, Ev );// The preprocessevent function of the keyq class is actually called....Int keycode = rotatekeycodelocked (EV. keycode );Int [] map = mkeyrotationmap;
For (INT I = 0; I
If (MAP = keycode)
Return map [I + 1];
}//Addlocked (Di, curtime,
source. Ie: window. event. under the srcElement standard: event.tar getnodeName: locate the Tag Name of the element */oUl. onmouseover = function (ev) {var ev = ev | window. event; var target = ev.tar get | ev. srcElement; // alert (target. innerHTML); if (target. nodeName. toLowerCase () = "li") {target. style. backg
1. Get the width, border color and other css (not line) in the style table is mainly IE6-7 support currentStyle, standard browser support getComputedStyle;
Instance: encapsulation FunctionCopy codeThe Code is as follows: function getStyle (obj, name ){If (obj. currentStyle ){Return obj. currentStyle [name];}Else {Return getComputedStyle (obj, false) [name];}}
Call: getStyle ('color ');
2. Get the scroll distanceDocument. body. scrollTop for standard browsersDocument.doc umentElement. scrollTop
1. Get the width, border color and other css (not line) in the style table is mainly IE6-7 support currentStyle, standard browser support getComputedStyle;Instance: encapsulation FunctionCopy codeThe Code is as follows:Function getStyle (obj, name ){If (obj. currentStyle ){Return obj. currentStyle [name];}Else {Return getComputedStyle (obj, false) [name];}} Call: getStyle ('color ');2. Get the scroll distanceDocument. body. scrollTop for standard browsersDocument.doc umentElement. scrollTop appl
indicates that the return type of the method is void.Click the non-MyButton area and the results are as follows:Click on the MyButton area and the results are as follows:With these two results we can find that the event is activity->viewgroup->view from the top down.However, there is a non-correspondence between the two results, that is, the first result of the Mylayout Onintercepttouchevent method is not executed when lifting, and the second result is executed. This is because the Dispatchtouc
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.