CN105843601A - Android system-based screen self-adaptive adaptation technology - Google Patents
Android system-based screen self-adaptive adaptation technology Download PDFInfo
- Publication number
- CN105843601A CN105843601A CN201610141760.3A CN201610141760A CN105843601A CN 105843601 A CN105843601 A CN 105843601A CN 201610141760 A CN201610141760 A CN 201610141760A CN 105843601 A CN105843601 A CN 105843601A
- Authority
- CN
- China
- Prior art keywords
- attribute
- child node
- adaptation
- android system
- layout
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/4492—Inheritance
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses an android system-based screen self-adaptive adaptation technology. In the technology, layout files are traversed to form a View tree structure, and then the sub-node attribute of the View tree structure is paired with a target attribute to form a new attribute set, and during the process of traversing the new attribute set, layout adaptation of each node of the View tree structure is realized through a duty ratio computing mode, and finally the adaptation of different devices is realized. The technology provided by the invention reduces the work load, and allows a developer to directly carry out the UI design according to the design plan. The residual resource files do not need to be generated, the adaptation development of the interactive interface is realized, and the excellent experience effect on application of different android devices is realized.
Description
Technical field
The present invention relates to Mobile solution development field, be specifically related to screen self adaptation based on Android system adaptive
Technology.
Background technology
On the one hand, due to the user open, any of Android system, developer, OEM vendor, operator
Can be customized Android, the degree of fragmentation causing Android system is increasingly severe;On the other hand by
Requirement in Android application interactive experience improves constantly, and causes Android developer to be required for more multi-model and does suitable
Allotment of labor makees.
In prior art, Google provides two kinds of technology at the adaptive aspect of screen: 1) enter main flow machine
Row " interface customizing " exploitation;2) percentage ratio layout and extension.But above two technology is not the most the most preferable
Implementation, there is the problem of coverage rate and workload in former technique, latter technique due to rely on father
Container, cause part control height that percentage ratio cannot be used to there is also needs to calculate percentage duty amount simultaneously
Problem.
Summary of the invention
[solving the technical problem that]
It is an object of the invention to above-mentioned prior art problem, it is provided that a kind of be specifically related to based on Android system
Screen self adaptation adaptation technique.This technology allows developer directly carry out UI design according to design drawing, it is not necessary to produce
Raw unnecessary resource file, it is achieved the adaptive development of interactive interface, final realization is applied in different peaces
The experience effect obtained on tall and erect equipment.
[technical scheme]
In order to reach above-mentioned technique effect, the present invention takes techniques below scheme:
The technology of the present invention first passes through traversal topology file and forms View tree construction, then by this View tree
The child node attribute of structure matches with objective attribute target attribute, forms new community set, then new in traversal
During community set, realize the layout of each node in View tree construction by the calculation of dutycycle and fit
Join, thus realize the adaptation to distinct device.
A kind of screen self adaptation adaptation technique based on Android system, it comprises the following steps:
(1) traversal topology file obtains View tree construction, by LinearLayout, FrameLayout
With the succession of RelativeLayout these three topology file, with realize to three kinds of topology files self
And the management of child node;
(2) corresponding internal stationary class LayoutParams in the three kinds of topology files inherited respectively is passed through, by son
Nodal community and objective attribute target attribute match, and form new community set;Then new genus is traveled through
Property set, constitute according to the rules correspondence attributes object, this attributes object is carried out with child node
Binding;
(3) all child nodes are carried out primary Calculation, obtain the attribute value of child node, and from child node
Community set bound in taking-up, adds to attribute value on corresponding child node attribute,
With LayoutParams, all properties is packaged, and the attribute of encapsulation is passed back to child node;
(4) it is laid out according to the sequential of system framework and draws flow process.
According to the present invention further technical scheme, described LayoutParams include layout_width,
Layout_height, layout_margin, textSize and padding.
According to the present invention further technical scheme, described attribute value is to hand over according to the UI design set
Size and the calculated dutycycle of resolution of current screen mutually.
According to the present invention further technical scheme, described regulation refers to when traveling through new community set,
Setting " px " is its keyword, whether comprises px according to attribute value in this community set and builds new
Attribute set objects, to realize the binding of itself and child node.
According to the present invention further technical scheme, during carrying out primary Calculation, according to child node
Attribute specification quotes baseOffset offset correction.
Will be described in detail the present invention below.
The present invention obtains View tree construction, and its view layout is as it is shown in figure 1, from ViewRoot object reference
The layout () method of Root View starts, and the onlayout () of method intrinsic call Root View realizes antithetical phrase and regards
Figure successively calls layout ();If sub-view is View subclass object, then only need to be in the heavy duty of sub-view
The internal layout view realizing oneself of onlayout ();If sub-view is ViewGroup subclass object, then press
Travel through one by one according to previously by Recursive Implementation.Flow process is drawn according to system View, logical in successively ergodic process
The calculation crossing dutycycle realizes the layout adaptation of each node, thus realizes the adaptation to distinct device.Its
In, View subclass object all depends on ViewGroup container, the layout management of View by directly under
ViewGroup Object Management group, forms the View tree construction of similar Fig. 1 more by the traversal topology file defined,
By several basic layout type in inheritance system UI, realize the management to corresponding layout type respectively.?
In the present invention, described child node is View subclass;LinearLayout, FrameLayout and
RelativeLayout is ViewGroup subclass, i.e. node.
The screen self adaptation adaptation technique based on Android system of the present invention is mainly used in android application and development
The adaptation issues of middle interactive interface.
The present invention compared with prior art, has a following beneficial effect:
The technology of the present invention decreases workload, allows developer directly carry out UI design according to design drawing, is not required to
Producing unnecessary resource file, it is achieved the adaptive development of interactive interface, final realization is applied in difference
Android device on the experience effect that obtained.
Accompanying drawing explanation
Fig. 1 is View tree construction schematic diagram;
Fig. 2 is the flow chart of present invention screen based on Android system self adaptation adaptation technique;
Fig. 3 is the statistical flowsheet figure that the invention belongs to the sex object.
Detailed description of the invention
Below in conjunction with embodiments of the invention, the invention will be further elaborated.
Embodiment:
A kind of screen self adaptation adaptation technique based on Android system as shown in Figure 2, it comprises the following steps:
(1) traversal topology file obtains View tree construction, by LinearLayout, FrameLayout
With the succession of RelativeLayout these three topology file, with realize to three kinds of topology files self
And the management of child node;
(2) corresponding internal stationary class LayoutParams in the three kinds of topology files inherited respectively is passed through, by son
Nodal community and objective attribute target attribute match, and form new community set;Then new genus is traveled through
Property set, constitute according to the rules correspondence attributes object, this attributes object is carried out with child node
Binding;
(3) all child nodes are carried out primary Calculation, obtain the attribute value of child node, and from child node
Community set bound in taking-up, adds to attribute value on corresponding child node attribute,
With LayoutParams, all properties is packaged, and the attribute of encapsulation is passed back to child node;
(4) it is laid out according to the sequential of system framework and draws flow process, when drawing sequential, need to be according to control
The information such as part size, position are laid out and draw flow process.
Described LayoutParams includes layout_width, layout_height, layout_margin, textSize
And padding.In LayoutParams is to need adaptive attribute, and wherein layout_margin includes
The attribute of layout_marginLeft and other margin;Padding includes paddingLeft and other padding
Attribute.
Described attribute value is that the resolution according to the UI mutual size of design set with current screen calculates
The dutycycle arrived.This step mainly achieves the adaptation technique of Android system UI, and it relates to mutual size
Defined by AndroidManifest.xml and read internal memory when program starts.
Described regulation refers to when traveling through new community set, and setting " px " is its keyword, according to this genus
In property set, whether attribute value comprises px as individual prescribed form to build new attribute set objects, with
Realize the binding of itself and child node.It is concrete as it is shown on figure 3, work as acquired View community set not contain px,
Then bind with this View according to original attribute, when this community set contains px, then will form attribute pair
As, and this attributes object is added in list, after completing property calculation, attributes object is tied up with this View
Fixed, do not complete if, then whether return attribute is in the step of prescribed form.
During carrying out primary Calculation, quote baseOffset offset correction according to the attribute specification of child node.
The detailed description of the invention of the present invention is as follows: when View subclass carries out onMeasure calculating, it is right to need
The node i.e. LayoutParams of topology file resets: parent is to container class ViewGroup subclass
Child node View subclass carry out attribute interpolation, attributes object is safeguarded with a List, is therefore followed by for
Ring calls and realizes attribute interpolation.Single attribute is an abstract object, needs to carry out affiliated sexual function respectively reality
Existing, the value of attribute calculates dutycycle according to resolution and the UI design reference of current screen.
More embodiment: be to the width calculation formula of target View: int desWidth=(int) (val*
1.0f/ (designWidth baseOffset) * screenWidth), wherein val is that form reads according to the rules
The design load of this attribute, designWidth is the reference width of UI design documentation, and screenWidth is that this sets
Standby width, baseOffset is for the side-play amount designed by this control, and this side-play amount is primarily to promote
The adaptive effect of part control.
Although reference be made herein to invention has been described for the explanatory embodiment of the present invention, and above-described embodiment is only
For the present invention preferably embodiment, embodiments of the present invention are also not restricted to the described embodiments, it should
Understanding, those skilled in the art can be designed that a lot of other amendments and embodiment, and these are revised and real
The mode of executing will fall within spirit disclosed in the present application and spirit.
Claims (5)
1. a screen self adaptation adaptation technique based on Android system, it is characterised in that it comprises the following steps:
(1) traversal topology file obtains View tree construction, by LinearLayout, FrameLayout
With the succession of RelativeLayout these three topology file, with realize to three kinds of topology files from
Body and the management of child node thereof;
(2) corresponding internal stationary class LayoutParams in the three kinds of topology files inherited respectively is passed through, by son
Nodal community and objective attribute target attribute match, and form new community set;Then new genus is traveled through
Property set, and constitute according to the rules correspondence attributes object, this attributes object is entered with child node
Row binding;
(3) all child nodes are carried out primary Calculation, obtain the attribute value of child node, and from child node
Community set bound in middle taking-up, adds corresponding child node attribute to by attribute value
On, with LayoutParams, all properties is packaged, and the attribute of encapsulation is passed back to
Child node;
(4) it is laid out according to the sequential of system framework and draws flow process.
Screen self adaptation adaptation technique based on Android system the most according to claim 1, it is characterised in that
Described LayoutParams includes layout_width, layout_height, layout_margin, textSize
And padding.
Screen self adaptation adaptation technique based on Android system the most according to claim 1, it is characterised in that
Described attribute value is that the resolution according to the UI mutual size of design set with current screen calculates
The dutycycle arrived.
Screen self adaptation adaptation technique based on Android system the most according to claim 3, it is characterised in that
Described regulation refers to when traveling through new community set, and setting " px " is its keyword, according to this genus
Property set in attribute value whether comprise px to build new attribute set objects, to realize itself and son
The binding of node.
Screen self adaptation adaptation technique based on Android system the most according to claim 3, it is characterised in that
During carrying out primary Calculation, quote baseOffset according to the requirement of attribute in child node and offset school
Just.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610141760.3A CN105843601B (en) | 2016-03-11 | 2016-03-11 | Screen self-adaptive adapting method based on android system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610141760.3A CN105843601B (en) | 2016-03-11 | 2016-03-11 | Screen self-adaptive adapting method based on android system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105843601A true CN105843601A (en) | 2016-08-10 |
CN105843601B CN105843601B (en) | 2019-03-22 |
Family
ID=56586941
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610141760.3A Active CN105843601B (en) | 2016-03-11 | 2016-03-11 | Screen self-adaptive adapting method based on android system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105843601B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110543278A (en) * | 2019-08-19 | 2019-12-06 | 广州点云科技有限公司 | Cross-device screen coordinate adaptation method and device and storage medium |
CN110968741A (en) * | 2018-09-30 | 2020-04-07 | 武汉斗鱼网络科技有限公司 | Android system View management method, storage medium, equipment and system |
CN112530433A (en) * | 2020-12-01 | 2021-03-19 | 杭州灵伴科技有限公司 | Universal voice instruction generation method and device and augmented reality display equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090106653A1 (en) * | 2007-10-23 | 2009-04-23 | Samsung Electronics Co., Ltd. | Adaptive document displaying apparatus and method |
CN102890632A (en) * | 2012-09-18 | 2013-01-23 | 深圳市融创天下科技股份有限公司 | Screen adaptation method, system and terminal device |
CN103744595A (en) * | 2013-12-30 | 2014-04-23 | 广州华多网络科技有限公司 | Self-adaption display method and configuration file generating method and device |
CN105094774A (en) * | 2014-05-13 | 2015-11-25 | 大唐软件技术股份有限公司 | Terminal system interface display method and apparatus |
CN105335445A (en) * | 2014-08-13 | 2016-02-17 | 北大方正集团有限公司 | Layout display method and device |
-
2016
- 2016-03-11 CN CN201610141760.3A patent/CN105843601B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090106653A1 (en) * | 2007-10-23 | 2009-04-23 | Samsung Electronics Co., Ltd. | Adaptive document displaying apparatus and method |
CN102890632A (en) * | 2012-09-18 | 2013-01-23 | 深圳市融创天下科技股份有限公司 | Screen adaptation method, system and terminal device |
CN103744595A (en) * | 2013-12-30 | 2014-04-23 | 广州华多网络科技有限公司 | Self-adaption display method and configuration file generating method and device |
CN105094774A (en) * | 2014-05-13 | 2015-11-25 | 大唐软件技术股份有限公司 | Terminal system interface display method and apparatus |
CN105335445A (en) * | 2014-08-13 | 2016-02-17 | 北大方正集团有限公司 | Layout display method and device |
Non-Patent Citations (1)
Title |
---|
王博: "Android***UI定制关键技术研究", 《万方学位论文数据库》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110968741A (en) * | 2018-09-30 | 2020-04-07 | 武汉斗鱼网络科技有限公司 | Android system View management method, storage medium, equipment and system |
CN110968741B (en) * | 2018-09-30 | 2022-06-24 | 武汉斗鱼网络科技有限公司 | Android system View management method, storage medium, equipment and system |
CN110543278A (en) * | 2019-08-19 | 2019-12-06 | 广州点云科技有限公司 | Cross-device screen coordinate adaptation method and device and storage medium |
CN112530433A (en) * | 2020-12-01 | 2021-03-19 | 杭州灵伴科技有限公司 | Universal voice instruction generation method and device and augmented reality display equipment |
WO2022116969A1 (en) * | 2020-12-01 | 2022-06-09 | 杭州灵伴科技有限公司 | General voice instruction generating method and apparatus, and augmented reality display device |
CN112530433B (en) * | 2020-12-01 | 2023-11-07 | 杭州灵伴科技有限公司 | General voice instruction generation method and device and augmented reality display device |
Also Published As
Publication number | Publication date |
---|---|
CN105843601B (en) | 2019-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104699508A (en) | System and method for quickly arranging and updating virtual environment in cloud computing platform | |
CN113347225B (en) | OTA (over the air) upgrading method and server for terminal equipment of Internet of things | |
CN109240688A (en) | Interface development method, electronic device and readable storage medium storing program for executing | |
CN103513976B (en) | Service flowpath modelling approach and device | |
CN104008223A (en) | Graphical expressing method for connection of virtual terminals of secondary system of intelligent substation | |
CN105843601A (en) | Android system-based screen self-adaptive adaptation technology | |
CN105159783A (en) | System task distribution method | |
CN104572059A (en) | Processing method and device for modifying application name | |
CN110007924A (en) | The automated construction method and system of YANG model configuration interface | |
CN107465771A (en) | A kind of network address section division methods and system | |
CN112965710A (en) | Processing method, device and system of computation graph | |
CN105867944A (en) | Web front-end terminal operating layer and implementing method thereof | |
CN105243237A (en) | Assembly technology structure tree and building method thereof | |
CN114880337B (en) | Map data integrated updating method, device, equipment and storage medium | |
CN109067562A (en) | Dynamic configuration update method and system, server and medium based on intelligent pointer | |
US20140095550A1 (en) | Converting source objects to target objects | |
CN109117127A (en) | Program code generation method, device and computer readable storage medium | |
CN106484452A (en) | A kind of unified configuring management method of software platform and device | |
CN104748757A (en) | Data updating method and device for navigation electronic map | |
CN103605814A (en) | Information processing method and information processing system in substation transformation process | |
CN105187487A (en) | Copying state machine modular framework design method oriented to cloud storage | |
CN107273193A (en) | A kind of data processing method and system towards many Computational frames based on DAG | |
CN104598250B (en) | A kind of system management architecture and its method for realizing management | |
CN105740543A (en) | QML based graphical electric power system modeling method and modeling system | |
CN105210059A (en) | Data processing method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |