Specific embodiment
The embodiment of the present invention has been input into the target view if it is determined that target view is located at outside visibility region
Character number is more than the max number of characters that the target view can show, then basis has been input into character and the reference-view
Position, determine the current location of target view, wherein the position of the reference-view is determined according to the character that has been input into,
And the area of the reference-view is more than the area of the target view;Current location according to the target view with it is described can
See the position in region, determine the display location of the target view.
It is and defeated in the target view because the embodiment of the present invention is it is determined that target view is located at outside visibility region
When the character number for entering is more than the max number of characters that the target view can show, the present bit of target view is redefined
Put;And the embodiment of the present invention it is determined that target view current location when, be the reference determined according to character by being input into
View, determines the current location of target view.And according to the current location of active view, and visibility region position,
Target view is translated, the display location of target view is determined.Due to the embodiment of the present invention it is determined that target view it is aobvious
When showing that mistake occurs in position, can automatic identification to there is mistake, and redefine out the display of correct target view
Put, without manual intervention, can flexibly determine the correct display location of target view, improve Consumer's Experience.
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with accompanying drawing the present invention is made into
One step ground is described in detail, it is clear that described embodiment is only some embodiments of the invention, rather than whole implementation
Example.Based on the embodiment in the present invention, what those of ordinary skill in the art were obtained under the premise of creative work is not made
All other embodiment, belongs to the scope of protection of the invention.
As shown in figure 4, a kind of method for determining view display location of the embodiment of the present invention includes:
Step 401, if it is determined that target view is located at outside visibility region, and the character being input into the target view
Number is more than the max number of characters that the target view can show, then basis has been input into character and the position of the reference-view
Put, determine the current location of target view, wherein the position of the reference-view is determined according to the character being input into, and institute
State the area of the area more than the target view of reference-view;
Step 402, the current location according to the target view and the position of the visibility region, determine that the target is regarded
The display location of figure.
The target view of the embodiment of the present invention is text view, and user can be by clicking on target view, in target view
In enter the input of line character;And target view is clicked in user, when being input into character in target view, can be ejected on screen
Entering method keyboard, so that user is input into character by entering method keyboard in target view.
The visibility region of the embodiment of the present invention is the region in screen in addition to entering method keyboard.
For example, the target view of the embodiment of the present invention can be input frame.
Wherein, the embodiment of the present invention determines that target view is located at outside visibility region, and it is visible to be that target view is entirely located in
Outside region, i.e.,:After entering method keyboard ejection, target view is entirely located in the region of entering method keyboard covering.
The embodiment of the present invention according to the length of target view, and in target view each character width, determine target
The max number of characters that can be shown in view.
Specifically, determining the width of each character according to the number that character takes pixel;And taken according to target view
The number of pixel determine the width of target view.
The application scenarios of the method for target view display location are determined with reference to the embodiment of the present invention, is described in detail.
The embodiment of the present invention is before the display location for determining target view using the above method, it has been determined that cross a mesh
The display location of view is marked, but, the display location of the target view determined for the first time is located at outside visibility region.
Can be understood as:The embodiment of the present invention includes two modules, it is assumed that respectively drafting module and correction module.Its
In, drafting module mainly performs the determining target view display location of the task;Correction module is mainly used in judging that drafting module is true
Whether the display location of the target view made is correct, it is determined that the display location mistake of the target view that drafting module is determined
When, correction module redefines out the display location of correct target view using the above method.
The embodiment of the present invention determines that the application scenarios of the method for target view display location are, user passes through entering method keyboard
Character is input into target view, the max number of characters that the target view can show is more than in the character number of user input
When, it is assumed that because user has pressed return key, cause entering method keyboard to be hidden.Due to user also need to continue be input into character, it is necessary to
Recall entering method keyboard;When user recalls entering method keyboard, above-mentioned drafting module needs to redefine the display of target view
Position.
The drafting module of the embodiment of the present invention it is determined that target view display location when, obtain target view
Rectangle (rectangle) parameter.
Specifically, so that target view is as input frame as an example, illustrating that drafting module obtains the side of input frame rectangle parameters
Method.
Drafting module is it is determined that before input frame display location, can travel through the View (view) of whole in display system and adjust
It is used to update the layout of View, coordinates computed and skew etc. with the onLayout methods of each View.Due to input frame
(EditText) TextView is inherited from, when the onLayout methods of EditText are called, TextView can be called
OnLayout methods, in the onLayout methods of TextView, can call a series of sides such as bringPointIntoView
Method, eventually calls the scrollToRectOrFocus methods in ViewRootImpl, the method to be defined as follows:
boolean scrollToRectOrFocus(Rect rectangle,boolean immediate)
Wherein, the type of rectangle parameters is Rect (rectangle), and the related significant data of Rect is as follows:
Rectangle parameters include left (left side), right (right side), top (on), bottom (under), it is stipulated that Rect's is big
It is small, also determine positions of the Rect relative to screen.
Input frame as shown in Figure 5, when screen resolution is 1920*1080, rectangle parameters represent input frame phase
To the position of screen.
The number of the character being input into target view due to user more than the max number of characters that target view can show,
The drafting module can get the rectangle parameters of mistake when the rectangle parameters of target view are obtained;To draw
The wrong corresponding view of rectangle parameters that module gets is used as reference-view;I.e. drafting module is according to reference-view
Rectangle parameters and visibility region mVisRect parameters, determine the display location of target area, cause target area
Display location determines mistake.
It should be noted that the position of the reference-view of the embodiment of the present invention is determined according to the character being input into, and
Area of the area of the reference-view more than the target view.
As shown in Figure 6, it is assumed that the max number of characters that can be shown in target area is 5, the character that now user has been input into
Number is 8, and the character that user has been input into is 1,2,3,4,5,6,7,8.And the region where character 4,5,6,7,8 is target view
Position.Drafting module when the rectangle parameters of target view are obtained, mistakenly by where character 1,2,3,4,5,6,7,8
Region as target view position;That is the embodiment of the present invention is using the region where character 1,2,3,4,5,6,7,8 as ginseng
Position where examining view.
Specifically, the embodiment of the present invention can use following method when it is determined that target area is outside visibility region.
1st, the rectangle parameters of reference-view, and the mVisRect parameters for obtaining visibility region are obtained;
Wherein, rectangle parameters include left, right, top, bottom;
MVisRect parameters also include left, right, top, bottom.
2nd, using intersect methods, judge that the rectangle parameters of reference-view are joined with the mVisRect of visibility region
Number is with the presence or absence of common factor.
Because reference-view is text view, the rectangle parameters of reference-view are joined with the mVisRect of visibility region
Should there is common factor in number;
If by intersect methods, determining that the rectangle parameters of reference-view are joined with the mVisRect of visibility region
Number is without common factor, it is determined that target area is located at outside visibility region.
If it should be noted that the embodiment of the present invention determines the rectangle of reference-view by intersect methods
Parameter has common factor with the mVisRect parameters of visibility region, then need rectangle parameters and visual field according to reference-view
The mVisRect parameters in domain are calculated, and reference-view is translated, so that reference-view moves to visibility region.But,
If by intersect methods, determining that the rectangle parameters of reference-view are not handed over the mVisRect parameters of visibility region
Collection, then do not move to reference-view.
Specifically, the intersect methods of the embodiment of the present invention can be realized using following code:
Wherein, the left in above-mentioned code, top, right, bottom represent the mVisRect parameters of viewing area, this
Left, this top, this right, this bottom represent the rectangle parameters of reference-view.
Because the embodiment of the present invention is when the display location of target view is determined according to the position of reference-view.Determine
The display location of target view is located at outside visibility region.Therefore, the embodiment of the present invention is it needs to be determined that to go out target view correct
Display location when, it is necessary first to determine target view current location (position of i.e. correct target view, not be ginseng
Examine the position of view).
The embodiment of the present invention determines the current location of target view according to the character being input into and the position of reference-view.
Optionally, it is determined that the line number of the character occupancy being input into;According to the line number, the number of the character being input into, institute
State the max number of characters that target view can show, and the reference-view position, determine the current of the target view
Position.
It should be noted that due to can show in the target view of the embodiment of the present invention maximum character when determine,
When the character number of user input is more than the max number of characters that target view can show, will can be input at first more than this most
The character of big number of characters is hidden.And when the mode for hiding character is different, the line number that the character being input into takes is different.Below
According to the line number that the character being input into takes, the method for the current location for determining target view is described separately.
First, the line number that the character being input into takes is a line.
The current location of the target view is determined according to following manner:
The difference of the max number of characters that the number according to the character being input into can show with the target view, and often
The width of individual character, determines the skew in the horizontal direction of the position of the current location of the target view and the reference-view
Amount;According to the side-play amount in the horizontal direction, and the reference-view position, determine the present bit of the target view
Put.
The position of embodiment of the present invention reference-view is determined according to all characters being input into;And target view work as
Anteposition is set to the region where the character of display in target view.And the line number taken in the character being input into is a line
When, the mode that expression hides character is that the character that will be had more is hidden in the left and right of target view.
When the line number that the character being input into takes is a line, the position of the current location relative to reference-view of target view
Put and be not changed in vertical direction, the current location of target view only exists horizontal direction relative to the position of reference-view
Skew.
It is determined that during side-play amount in horizontal direction, the number of the character that will be input into can show with the target view
Max number of characters difference, the product with each character duration, as the position of current location and the reference-view of target view
Put side-play amount in the horizontal direction.
After being input into character in the target view according to user, character display order is different, the position of target view relative to
The offset direction of the horizontal direction of the position of reference-view is also different.
If the 1, first character is located at the leftmost side of all characters in the character being input into, by the reference-view
Left border to side-play amount described in right translation, using the position of the reference-view after translation as the target view present bit
Put.
In the character being input into first character be located at all characters the leftmost side when, represent input character from a left side to
The right side shows successively;When the number of characters of input is more than the max number of characters that target view can show, the character that will be input at first
Hide, that is, the character that will be close to left side is hidden.
Specifically, input character as shown in Figure 7 A.Assuming that the max number of characters that target view can show is 5,
The number of characters of input is 8;User is followed successively by 1,2,3,4,5,6,7,8 in the character that target view is input into;Then currently regarded in target
The character shown in figure is followed successively by 4,5,6,7,8 from left to right;Character 1,2,3 is hidden.
It is determined that target view current location when, the position of reference-view is where the character 1,2,3,4,5,6,7,8
Position.It is determined that the difference of max number of characters that the number of the character being input into can show with the target view is 3, and often
The width of individual character is a, it is determined that the current location of target view and the position of reference-view side-play amount in the horizontal direction
3a.By the left border of reference-view translational offsets amount 3a to the right, the current location of target view is obtained.
If the 2, first character is located at the rightmost side of all characters in the character being input into, by the reference-view
Right side boundary to side-play amount described in left, using the position of the reference-view after translation as the target view present bit
Put.
In the character being input into first character be located at all characters the rightmost side when, represent input character from the right side to
A left side shows successively;When the number of characters of input is more than the max number of characters that target view can show, the character that will be input at first
Hide, that is, the character that will be close to right side is hidden.
Specifically, input character as shown in Figure 7 B.Assuming that the max number of characters that target view can show is 5,
The number of characters of input is 8;User is followed successively by 1,2,3,4,5,6,7,8 in the character that target view is input into;Then currently regarded in target
The character shown in figure is followed successively by 4,5,6,7,8 from right to left;Character 1,2,3 is hidden.
It is determined that target view current location when, the position of reference-view is where the character 1,2,3,4,5,6,7,8
Position.It is determined that the difference of max number of characters that the number of the character being input into can show with the target view is 3, and often
The width of individual character is a, it is determined that the current location of target view and the position of reference-view side-play amount in the horizontal direction
3a.By the right side boundary of reference-view translational offsets amount 3a to the left, the current location of target view is obtained.
2nd, the line number that the character being input into takes is more than a line.
The current location of the target view is determined according to following manner:
According to the line number, and each character height, determine the current location of the target view and the reference
The position of view side-play amount in vertical direction;According to the side-play amount in the vertical direction, and the reference-view
Position, determines the current location of the target view.
The position of embodiment of the present invention reference-view is determined according to all characters being input into;And target view work as
Anteposition is set to the region where the character of display in target view.And the line number taken in the character being input into is more than a line
When, the mode that expression hides character is that the character that will be had more is hidden in the up-downgoing of target view.
When the line number that the character being input into takes is more than a line, the current location of target view is relative to reference-view
Position is not changed in the horizontal direction, and the current location of target view only exists vertical direction relative to the position of reference-view
Skew.
It is determined that during side-play amount in vertical direction, the line number that the character of input takes obtained, the value that the line number is subtracted 1,
With the product of the height of each character, as position in vertical direction inclined of current location and the reference-view of target view
Shifting amount.
After the number of characters that user is input into target view is more than target view maximum Display Characters Per Frame, the character having more exists
The up-downgoing of target view is hidden.And the Stealth Modus of the character having more are different, and the position of target view is relative to ginseng
The offset direction for examining the vertical direction of the position of view is also different.
Specifically, the embodiment of the present invention is in the Stealth Modus of the character for judging to have more, it is according in the character being input into
What the position of first character determined.When first character is located at the first row of order from top to bottom in the character being input into,
The character that expression will have more is hidden in the lastrow of target view;First character is located under in the character being input into
To upper order the first row when, the character that will have more of expression is hidden in the next line of target view.
If the 1, first character is located at the first row of order from top to bottom in the character being input into, by the reference
The top margin of view translates downwards the side-play amount, using the position of the reference-view after translation working as the target view
Front position;
When first character is located at the first row of order from top to bottom in the character being input into, the character that expression will have more
It is hidden in the lastrow of target view.And it is more than the max number of characters that target view can show in the number of characters of input
When, the character that will be input at first is hidden in the lastrow of target view.
Specifically, input character as seen in figure 7 c.Assuming that the max number of characters that target view can show is 5,
The number of characters of input is 8;User is followed successively by 1,2,3,4,5,6,7,8 in the character that target view is input into;Then currently regarded in target
The character shown in figure is followed successively by 4,5,6,7,8 from right to left;Character 1,2,3 is hidden in the top of target view.
It is determined that target view current location when, the position of reference-view is the location of character 4,5,6,7,8 for length
The length in domain, is highly the height of two line characters.It is determined that two rows of line number position shared by the character being input into, and each character
Highly it is b, then determines the position side-play amount b in vertical direction of current location and the reference-view of target view.Will ginseng
The downward translational offsets amount b of top margin of view is examined, the current location of target view is obtained.
If the 2, first character is located at the first row of order from top to bottom in the character being input into, by the reference
The bottom margin of view translates up the side-play amount, using the position of the reference-view after translation working as the target view
Front position.
When first character is located at the first row of order from top to bottom in the character being input into, the character that expression will have more
It is hidden in the next line of target view.And it is more than the max number of characters that target view can show in the number of characters of input
When, the character that will be input at first is hidden in the next line of target view.
Specifically, input character as illustrated in fig. 7d.Assuming that the max number of characters that target view can show is 5,
The number of characters of input is 8;User is followed successively by 1,2,3,4,5,6,7,8 in the character that target view is input into;Then currently regarded in target
The character shown in figure is followed successively by 4,5,6,7,8 from right to left;Character 1,2,3 is hidden in the lower section of target view.
It is determined that target view current location when, the position of reference-view is the location of character 4,5,6,7,8 for length
The length in domain, is highly the height of two line characters.It is determined that two rows of line number position shared by the character being input into, and each character
Highly it is b, then determines the position side-play amount b in vertical direction of current location and the reference-view of target view.Will ginseng
The bottom margin for examining view translates up side-play amount b, obtains the current location of target view.
The embodiment of the present invention it is determined that target view current location when.Can specifically be realized using following code:
The embodiment of the present invention behind the current location for determining target view, current location according to target view with it is visible
The position in region, determines the display location of the target view.
Wherein, the display location of target view is fully located among visibility region.
It should be noted that the embodiment of the present invention is according to the current location of target view and the position of visibility region, it is determined that
The method of the display location of the target view, the method for using prior art, in this not go into detail.
The line number for being taken with the character being input into below is a line, and first character is located at institute in the character being input into
Have as a example by the leftmost side of character, illustrate that the embodiment of the present invention determines the method overall flow of view display location.
As shown in figure 8, the embodiment of the present invention determines that the method for view display location includes:
Step 801, judge target view whether be located at visibility region;If so, step 802 is performed, if it is not, performing step
803;
Step 802, judge whether the character number being input into target view can show more than the target view
Max number of characters;If so, step 804 is performed, if it is not, performing step 803;
Step 803, flow terminate;
The difference of step 804, the max number of characters that can be shown with the target view according to the number of the character being input into
Value, and each character width, determine the current location of the target view with the position of the reference-view in level side
Upward side-play amount;
Step 805, by the left border of reference-view to side-play amount described in right translation, by the position of the reference-view after translation
Put the current location as the target view;
Step 806, the current location according to the target view and the position of the visibility region, determine that the target is regarded
The display location of figure.
Based on same inventive concept, a kind of equipment for determining view display location is additionally provided in the embodiment of the present invention, by
Determine that the method for view display location is similar to the embodiment of the present invention in the principle of the equipment solve problem, thus the equipment reality
The implementation of the method for may refer to is applied, part is repeated and is repeated no more.
As shown in figure 9, the equipment that the embodiment of the present invention determines view display location, including:
Determining module 901, it is and defeated in the target view for if it is determined that target view is located at outside visibility region
The character number for entering is more than the max number of characters that the target view can show, then basis has been input into character and the reference
The position of view, determines the current location of target view, wherein the position of the reference-view is true according to the character being input into
It is fixed, and the reference-view area of the area more than the target view;
Processing module 902, for the current location according to the target view and the position of the visibility region, determines institute
State the display location of target view.
Optionally, the determining module 901, specifically for:
It is determined that the line number that the character being input into takes;Regarded according to the line number, the number of the character being input into, the target
The max number of characters that figure can show, and the reference-view position, determine the current location of the target view.
Optionally, the determining module 901, specifically for:
If the line number is a line, the current location of the target view is determined according to following manner:
The difference of the max number of characters that the number according to the character being input into can show with the target view, and often
The width of individual character, determines the skew in the horizontal direction of the position of the current location of the target view and the reference-view
Amount;According to the side-play amount in the horizontal direction, and the reference-view position, determine the present bit of the target view
Put.
Optionally, the determining module 901, specifically for::
If first character is located at the leftmost side of all characters in the character being input into, by the reference-view
Left border to side-play amount described in right translation, using the position of the reference-view after translation as the target view present bit
Put;Or
If first character is located at the rightmost side of all characters in the character being input into, by the reference-view
Right side boundary to side-play amount described in left, using the position of the reference-view after translation as the target view present bit
Put.
Optionally, the determining module 901, specifically for:
If the line number is more than a line, the current location of the target view is determined according to following manner:
According to the line number, and each character height, determine the current location of the target view and the reference
The position of view side-play amount in vertical direction;According to the side-play amount in the vertical direction, and the reference-view
Position, determines the current location of the target view.
Optionally, the determining module 901, specifically for:
If first character is located at the first row of order from top to bottom in the character being input into, the reference is regarded
The top margin of figure translates downwards the side-play amount, using the position of the reference-view after translation as the current of the target view
Position;Or
If first character is located at the first row of order from top to bottom in the character being input into, the reference is regarded
The bottom margin of figure translates up the side-play amount, using the position of the reference-view after translation as the current of the target view
Position.
Above by reference to the method, device (system) and/or the frame of computer program product that show according to the embodiment of the present application
Figure and/or flow chart describe the application.It should be understood that block diagram and/or flow diagram can be realized by computer program instructions
The combination of the block of one block and block diagram and/or flowchart illustration of figure.These computer program instructions can be supplied to logical
With computer, the processor of special-purpose computer and/or other programmable data processing units, to produce machine so that via meter
The instruction that calculation machine processor and/or other programmable data processing units are performed is created for realizing block diagram and/or flow chart block
In specified function/action method.
Correspondingly, the application can also be implemented with hardware and/or software (including firmware, resident software, microcode etc.).More
Further, the application can take computer can be used or computer-readable recording medium on computer program product shape
Formula, there is the computer realized in media as well can be used or computer readable program code for it, to be made by instruction execution system
With or combined command execution system and use.In the present context, computer can be used or computer-readable medium can be with
It is arbitrary medium, it can include, store, communicating, transmitting or transmission program, makes with by instruction execution system, device or equipment
With, or combined command execution system, device or equipment uses.
Obviously, those skilled in the art can carry out various changes and modification without deviating from essence of the invention to the present invention
God and scope.So, if these modifications of the invention and modification belong to the scope of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to comprising these changes and modification.