CN106557326B - Method and system for setting layout of cover layer - Google Patents

Method and system for setting layout of cover layer Download PDF

Info

Publication number
CN106557326B
CN106557326B CN201611068509.5A CN201611068509A CN106557326B CN 106557326 B CN106557326 B CN 106557326B CN 201611068509 A CN201611068509 A CN 201611068509A CN 106557326 B CN106557326 B CN 106557326B
Authority
CN
China
Prior art keywords
control
layout
reminded
effect control
objects
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.)
Active
Application number
CN201611068509.5A
Other languages
Chinese (zh)
Other versions
CN106557326A (en
Inventor
刘一琛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201611068509.5A priority Critical patent/CN106557326B/en
Publication of CN106557326A publication Critical patent/CN106557326A/en
Application granted granted Critical
Publication of CN106557326B publication Critical patent/CN106557326B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention discloses a method for setting a layer layout, which relates to the technical field of computer interfaces and comprises the steps of obtaining an object of PhoneWindow in a page; acquiring an object with an adaptive layer layout from objects of PhoneWindow; adding objects of the layer layout using the addview function in the objects of the adaptation layer layout. The invention adds the object of the layer layout by using the addview function in the object of the adaptation layer layout in the objects of PhoneWindow, and the layer layout can be suitable for various types of page layouts. The invention also discloses a system for setting the cover layer layout.

Description

Method and system for setting layout of cover layer
Technical Field
The invention relates to the technical field of computer interfaces, in particular to a method and a system for setting a cover layer layout.
Background
When an application is opened for the first time in the android system, the application pops up a cover layer on some interfaces to guide or indicate key operations in some applications of a user, or some hidden user interaction logics, such as long-button pressing operations or complex gesture operations of the user.
However, there are multiple pages in each application, and there are multiple pages that need to show the mask layer, but since the layout of each page is different, when setting the mask layer, different mask layers are customized for each different page, and a corresponding mask layer layout is added in the page layout. The drawback is that the extensibility is poor, and when a page needs to be changed due to a product, the layers of the page must be changed together, and the corresponding layer layout must also be changed. When there are many masks for an application, the workload of changing all corresponding mask layouts is quite large, and a lot of labor and time are consumed.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and a system for setting a layer layout, which can conveniently and quickly add the layer layout which is generally used for various page layouts.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows: a method for setting a cover layer layout is characterized in that:
acquiring an object of PhoneWindow in a page;
acquiring an object with an adaptive layer layout from objects of PhoneWindow;
adding objects of the layer layout using the addview function in the objects of the adaptation layer layout.
On the basis of the technical scheme, the objects of the adaptive layer layout are obtained through the corresponding id of the objects of the adaptive layer layout.
On the basis of the technical scheme, after the object of the Mongolian layout is added in the page, an effect control is added for a control to be reminded in the object of the Mongolian layout.
On the basis of the technical scheme, the process of adding the effect control for the control to be reminded in the object of the Mongolian layout comprises the following steps:
creating an object of a layout parameter thereof among objects of the Mongolian layout;
acquiring the coordinates of the effect control in a screen;
transmitting the coordinates of the effect control in the screen into the object of the layout parameter;
and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function.
On the basis of the technical scheme, the coordinates of the effect control in the screen comprise an abscissa and an ordinate, and the process of acquiring the coordinates of the effect control in the screen comprises the following steps: obtaining the object of the control to be reminded through the id of the control to be reminded in the object of PhoneWindow; acquiring the abscissa and the ordinate of the control to be reminded in the screen from the object of the control to be reminded, then acquiring the width and the height of the control to be reminded, and calculating the abscissa and the ordinate of the center of the control to be reminded; and obtaining the width and the height of the effect control in a screen from an object of the effect control, and calculating the abscissa and the ordinate of the effect control according to the center coordinate of the control to be reminded and the width and the height of the effect control in the screen.
On the basis of the technical scheme, the abscissa of the center of the control to be reminded is equal to the abscissa of the control to be reminded plus one half of the width of the control to be reminded; and the vertical coordinate of the center of the control to be reminded is equal to the vertical coordinate of the control to be reminded plus one half of the height of the control to be reminded.
On the basis of the technical scheme, the abscissa of the effect control is equal to the abscissa of the center of the control to be reminded minus one half of the width of the effect control; and the vertical coordinate of the effect control is equal to the height of the effect control obtained by subtracting one half of the height of the effect control from the vertical coordinate of the center of the control to be reminded.
On the basis of the technical scheme, a plurality of effect controls can be added to one to-be-reminded control.
The invention also discloses a system for setting the layout of the cover layer, which comprises:
the layer layout adding module is used for acquiring an object of PhoneWindow in the page; acquiring an object with an adaptive layer layout from objects of PhoneWindow; adding objects of the layer layout by using an addview function in the objects of the adaptation layer layout;
the effect control adding module is used for creating an object of the layout parameter in the object of the Mongolian layout; acquiring the coordinates of the effect control in a screen; transmitting the coordinates of the effect control into the object of the layout parameter; and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function.
On the basis of the technical scheme, a plurality of effect controls can be added to one to-be-reminded control.
Compared with the prior art, the invention has the advantages that:
(1) the invention obtains the object of the layout of the adaptation layer from the objects of PhoneWindow; the objects of the layer layout are added by using the addview function in the objects of the adaptation layer layout, and each page in the android application is displayed through the objects of PhoneWindow, so that the objects of the layer layout are added by using the addview function in the objects of the adaptation layer layout in the objects of the PhoneWindow, and the layer layout can be suitable for various types of page layouts.
(2) When one to-be-reminded control in the Mongolian layer is provided with an effect control, creating an object of a layout parameter in the object of the Mongolian layer layout; transmitting the coordinates of the effect control into an object of the layout parameters; and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function. When the position of the control to be reminded is changed, the coordinate of the effect control can be automatically changed along with the change of the position of the control to be reminded without changing the position logic of the effect control. Even if the control to be reminded is replaced, the position logic of the effect control does not need to be changed, and only the ID of the control to be reminded needs to be replaced by the ID corresponding to the new control to be reminded.
Drawings
FIG. 1 is a schematic flow chart illustrating a method for setting a layer layout according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating adding an effect control to a control to be reminded in an object of a Mongolian layout in the Mongolian layout setting method according to the embodiment of the present invention;
fig. 3 is a schematic structural diagram of a layer layout setting system according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Referring to fig. 1, an embodiment of the present invention provides a method for setting a mask layout, including the following steps:
s101, acquiring an object of PhoneWindow by using a getWindow () function in a page;
s102, acquiring an object of the layout of the adaptation layer by using a findViewById function in the object of PhoneWindow;
s103, adding the objects of the layer layout by using an addview function in the objects of the adaptation layer layout.
WindowManager is an important service in Android. The window mechanism of the whole Android system is based on the WindowManager service. The WindowManager service translates the user's operations into instructions, sending the various windows presented on the interface. PhoneWindow is an encapsulation of the windows manager service, and in android applications each page is displayed through its PhoneWindow object. That is to say, the layout of each page is actually loaded into the windows manager service for display, the windows manager service needs to add a root view for display, and the layout of the page needs to be loaded in the root view through the adaptation layer. So if a mask can be added to the adaptation layer, only the layout of the adaptation layer needs to be adapted to make the mask layout adaptable to various types of page layouts.
And the findViewById function acquires the objects of the adaptation layer layout through the corresponding ids of the objects of the adaptation layer layout. id is defined as a static constant window.
Referring to fig. 2, after an object of a Mongolian layout is added to a page, an effect control is added to a control to be reminded in the object of the Mongolian layout. The process comprises the following steps:
s201, creating an object of a layout parameter in the object of the Mongolian layout;
s202, obtaining the coordinates of the effect control in the screen;
s203, transmitting the coordinates of the effect control into an object of the layout parameters through a leftMargin function and a topMargin function;
and S204, adding the object of the effect control and the object of the layout parameter in the object of the hierarchical layout by using the addview function.
When one to-be-reminded control in the Mongolian layer is provided with an effect control, creating an object of a layout parameter in the object of the Mongolian layer layout; transmitting the coordinates of the effect control into an object of the layout parameters; and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function. When the position of the control to be reminded is changed, the coordinate of the effect control can be automatically changed along with the change of the position of the control to be reminded without changing the position logic of the effect control. Even if the control to be reminded is replaced, the position logic of the effect control does not need to be changed, and only the ID of the control to be reminded needs to be replaced by the ID corresponding to the new control to be reminded.
The coordinates of the effect control in the screen comprise an abscissa and an ordinate, and the process of obtaining the coordinates of the effect control in the screen comprises the following steps:
(1) obtaining an object of a control to be reminded by using a findViewById function in an object of PhoneWindow through an id of the control to be reminded;
(2) acquiring the abscissa and the ordinate of the control to be reminded in a screen by using a getLocationOnScreen function in an object of the control to be reminded, then acquiring the width and the height of the control to be reminded through a getWidth function and a getHeight function, and calculating the abscissa and the ordinate of the center of the control to be reminded; the abscissa of the center of the control to be reminded is equal to the abscissa of the control to be reminded plus one half of the width of the control to be reminded; and the vertical coordinate of the center of the control to be reminded is equal to the vertical coordinate of the control to be reminded plus one half of the height of the control to be reminded.
(3) And obtaining the width and the height of the effect control in the screen by using a getWidth function and a getHeight function in the object of the effect control, and calculating the abscissa and the ordinate of the effect control according to the central coordinate of the control to be reminded and the width and the height of the effect control in the screen.
The abscissa of the effect control is equal to the abscissa of the center of the control to be reminded minus one half of the width of the effect control; the vertical coordinate of the effect control is equal to the height of the effect control obtained by subtracting one half of the vertical coordinate of the center of the control to be reminded. One to-be-reminded control can add a plurality of effect controls.
Referring to fig. 3, the present invention also discloses a system for setting a cover lay layout, comprising:
the system comprises a cover layer layout adding module, a page processing module and a display module, wherein the cover layer layout adding module is used for obtaining objects of PhoneWindow by using a getWindow () function in a page; obtaining an object of the layout of the adaptation layer by using a findViewById function in an object of PhoneWindow; adding objects of the layer layout using the addview function in the objects of the adaptation layer layout.
The effect control adding module is used for creating an object of the layout parameter in the object of the Mongolian layout; acquiring the coordinates of the effect control in a screen; transmitting the coordinates of the effect control into an object of the layout parameters through a leftMargin function and a topMargin function; and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function. One to-be-reminded control can add a plurality of effect controls.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention. Those not described in detail in this specification are within the skill of the art.

Claims (8)

1. A method for setting a cover layer layout is characterized in that:
acquiring an object of PhoneWindow in a page;
acquiring an object with an adaptive layer layout from objects of PhoneWindow;
adding objects of the layer layout by using an addview function in the objects of the adaptation layer layout;
after the object of the Mongolian layout is added into the page, adding an effect control for a control to be reminded in the object of the Mongolian layout;
the process of adding the effect control for the control to be reminded in the object with the Mongolian layout comprises the following steps:
creating an object of a layout parameter thereof among objects of the Mongolian layout;
acquiring the coordinates of the effect control in a screen;
transmitting the coordinates of the effect control in the screen into the object of the layout parameter;
and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function.
2. The cover lay-up setting method of claim 1, wherein: and acquiring the objects of the adaptive layer layout through the id corresponding to the objects of the adaptive layer layout.
3. The cover lay-up setting method of claim 1, wherein: the coordinates of the effect control in the screen comprise an abscissa and an ordinate, and the process of acquiring the coordinates of the effect control in the screen comprises the following steps:
obtaining the object of the control to be reminded through the id of the control to be reminded in the object of PhoneWindow;
acquiring the abscissa and the ordinate of the control to be reminded in the screen from the object of the control to be reminded, then acquiring the width and the height of the control to be reminded, and calculating the abscissa and the ordinate of the center of the control to be reminded;
and obtaining the width and the height of the effect control in a screen from an object of the effect control, and calculating the abscissa and the ordinate of the effect control according to the center coordinate of the control to be reminded and the width and the height of the effect control in the screen.
4. The cover lay-up setting method of claim 3, wherein: the abscissa of the center of the control to be reminded is equal to the abscissa of the control to be reminded plus one half of the width of the control to be reminded; and the vertical coordinate of the center of the control to be reminded is equal to the vertical coordinate of the control to be reminded plus one half of the height of the control to be reminded.
5. The cover lay-up setting method of claim 3, wherein: the abscissa of the effect control is equal to the abscissa of the center of the control to be reminded minus one half of the width of the effect control; and the vertical coordinate of the effect control is equal to the height of the effect control obtained by subtracting one half of the height of the effect control from the vertical coordinate of the center of the control to be reminded.
6. The cover lay-up setting method of claim 1, wherein: one to-be-reminded control can add a plurality of effect controls.
7. A cover lay out setup system, comprising:
the layer layout adding module is used for acquiring an object of PhoneWindow in the page; acquiring an object with an adaptive layer layout from objects of PhoneWindow; adding objects of the layer layout by using an addview function in the objects of the adaptation layer layout;
the effect control adding module is used for creating an object of the layout parameter in the object of the Mongolian layout; acquiring the coordinates of the effect control in a screen; transmitting the coordinates of the effect control into the object of the layout parameter; and adding an object of an effect control and an object of a layout parameter in the object of the Mongolian layout by using an addview function.
8. The cover lay-up setup system of claim 7, wherein: one to-be-reminded control can add a plurality of effect controls.
CN201611068509.5A 2016-11-25 2016-11-25 Method and system for setting layout of cover layer Active CN106557326B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611068509.5A CN106557326B (en) 2016-11-25 2016-11-25 Method and system for setting layout of cover layer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611068509.5A CN106557326B (en) 2016-11-25 2016-11-25 Method and system for setting layout of cover layer

Publications (2)

Publication Number Publication Date
CN106557326A CN106557326A (en) 2017-04-05
CN106557326B true CN106557326B (en) 2020-01-03

Family

ID=58445156

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611068509.5A Active CN106557326B (en) 2016-11-25 2016-11-25 Method and system for setting layout of cover layer

Country Status (1)

Country Link
CN (1) CN106557326B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970415A (en) * 2014-04-13 2014-08-06 数源科技股份有限公司 Method for achieving fade-in and fade-out effects based on Android
CN106033411A (en) * 2015-03-20 2016-10-19 广州金山移动科技有限公司 Object layout method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970415A (en) * 2014-04-13 2014-08-06 数源科技股份有限公司 Method for achieving fade-in and fade-out effects based on Android
CN106033411A (en) * 2015-03-20 2016-10-19 广州金山移动科技有限公司 Object layout method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Android用户首次打开APP出现教学蒙层效果的实现;zexingzhong;《https://blog.csdn.net/Sundayzhong/article/details/46010739》;20150526;博客全文 *
Android页面中的引导蒙层的使用;wheatHusks;《https://blog.csdn.net/shihuiyun/article/details/52117760》;20160804;全文 *

Also Published As

Publication number Publication date
CN106557326A (en) 2017-04-05

Similar Documents

Publication Publication Date Title
CN110704136B (en) Method for rendering applet components, client, electronic device and storage medium
CN105630512A (en) Method and system for implementing mobile device data tracking through software development toolkit
CN104615538A (en) Mobile phone application testing method based on mobile phone interface control elements
CN101763234B (en) Method and device for simulating various screen resolutions
CN110399583B (en) Page display method and device, electronic equipment and storage medium
CN106126489A (en) A kind of report file dynamic chart edit methods and system
CN105373534B (en) List display method and device and list display terminal
CN103064691A (en) Method and device for producing desktop icon of electronic equipment
US20150331584A1 (en) Use of style sets to assist a user in digitizing GIS layers
CN104102734A (en) Data display method and system
CN103530134B (en) A kind of configurable software platform structure
CN103473041A (en) Visualized data processing method and system
CN105808035A (en) Icon display method and apparatus
CN104331244A (en) Method for executing application programs
CN106557326B (en) Method and system for setting layout of cover layer
US10402707B2 (en) Interactive optical code creation
CN104090759A (en) Template file based data filling method
US9158452B2 (en) Early drawing system and method to improve touch screen response
CN102222109A (en) Data processing device and method
CN105955730A (en) Method for obtaining SSR (Server Security Reinforcement) centralized management platform statement
CN103617064A (en) Improved method for updating mobile client product
WO2016201813A1 (en) Dynamic layout method and system based on android
CN102789379B (en) Build the method and apparatus of user interface
CN102521129B (en) Testing method and testing device for owner-drawing window
US9164668B2 (en) Defining object groups in 3D

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant