The use of android adaptation tool (ScreenMatch plug-in)

The latest and most complete article (2018-08-25): https://blog.csdn.net/fesdgasdgasdg/article/details/82054971

Please see the principle of dp mode screen adaptation: http://blog.csdn.net/fesdgasdgasdg/article/details/52325590

                                            http://download.csdn.net/download/fesdgasdgasdg/9913744

For how to use bat batch files, please see: http://blog.csdn.net/fesdgasdgasdg/article/details/78107653

Please see the plug-in source code: https://github.com/mengzhinan/ScreenMatch

 

For ease of use, I changed the way of double-clicking bat to the way of right-clicking the pop-up menu on the project in Android Studio. Select the menu to complete all the work, the principle is the same as the bat method.

The use steps are as follows:

1. Download and install.

Click Browse repositories... to search and install. After installation, you can see the ScreenMatch plug-in, with description information and related connections on the right.

 

2. Bring up the menu.

After installation, right-click the menu (or press the shortcut key) on any directory or file of the project to see the ScreenMatch option.

 

3. Choose which module to perform the adaptation under.

That is, based on which module res/values/dimens.xml file is used as the reference dimension file, the generated dimension files of other sizes are placed under which module.

 

Choose one and click OK.

 

 

If it is correct, there will be a success prompt, as shown in the figure above. Finished, it's that simple to use.

 

4. Provide a sample of the default dimens file.

A sample of default dimens.xml file is provided in the root directory of the project, for fear that you don't know how to write it, or you are lazy. If you don’t need it, you can delete it. You can configure whether to generate or not in the configuration file mentioned later.

 

5. Generate configuration files.

The configuration file is generated. If it is deleted or not created, all the adaptations use the default values. For the default values, please see the source code.

 

6. Detailed configuration file.



#
# The mobile phone widthDP benchmark value is generally 360dp, and it is not recommended to change it unless you have a deep insight into the principle of screen adaptation. Otherwise, do not give yes or give 360, the default value in the program is 360

base_dp=360

 


# What other widthDP values ​​do you need to adapt? Multiple values ​​are separated by commas. If the calculated widthDP value has a decimal, round it. Metaphor 411.948, then take 411
# The widthDP value of the default adaptation of the system is: 384,392,400,410,411,480,533,592,600,640,662,720,768,800,811,820,960,961,1024,1280,1365
match_dp=

 


# If you feel that some values ​​of the default adaptation of the system are not desired, set them here, and these values ​​will be ignored during the next adaptation. Multiple values ​​are separated by commas.
ignore_dp=

 


# Which directories in the project root directory are not modules or you do not want them to be displayed in Dalog, just set them here. Multiple values ​​are separated by commas.
# The system ignores these directories by default: .gradle,gradle,.idea,build,.git
ignore_module_name=

 


# Please set the default module for processing and storing dimes adaptation files.
# If you set the Dialog not to pop up later, the system defaults to this module path to handle the adaptation operation during adaptation.
match_module=app

 


# Whether to not pop up the selection dialog box during adaptation, use the default value of match_module above.
# The value assigned here is true or false, and the default value is false, that is, a dialog box will pop up.
not_show_dialog=false

 


# Do you no longer generate the default dimens sample files in the project root directory? I'm afraid you can't write it, so I generated
# for you. Assign a value of true or false here, and the default is false, which means it is generated.
not_create_default_dimens=false

 


# Whether to adapt the sp font at the same time. Because I am afraid that the fonts will also be inaccurately scaled with xxxdp/360dp.
# The value assigned here is true or false, and the default value is true, that is, sp is the same as dp, and both are scaled proportionally. To be studied and verified here.
is_match_font_sp=true

 

//===Following update============================================================================================================================================================================================== ====================

# Regarding the generated dimens.xml adaptation folder, do you want to use values-wXXXdp or values-swXXXdp format?
# Through the review of the official website documents, sw means the meaning of smallest width dp, that is, always use the smallest width dp value.
# The advantage of this is that it can solve the unexpected bugs that occur when the mobile phone is switched between horizontal and vertical screens, that is, the width and height of some views will be doubled.
# Metaphor: your phone’s widthDP=360dp, heightDP=640dp.
# If the phone is looking for values-w360dp or the default 360dp dimens.xml file value under values ​​in the vertical screen;
# If the phone is rotated in landscape mode, the phone will look for the dimens.xml file value in the values-w640dp directory;
# Therefore, Cause the UI to change.
# sw means that whether it is horizontal or vertical screen, the mobile phone system will use the minimum width dp value;
# That is, in the above example, values-sw360dp or the default 360dp dimens.xml file value under values ​​is used for horizontal and vertical screens.
# If the value of the following configuration item is false, it means that you only want to generate the values-wXXXdp format, if your app does not involve the horizontal screen of the page.
# If the value is not given or the value is true, it means that the values-swXXXdp format is generated.
# The default value is true.
create_values_sw_folder=true


If you find that some of the above values ​​are not in the screenMatch.properties configuration file in your project,
please delete your configuration file, right-click the project and run the plug-in again, and the latest configuration will be generated again.


Regarding the content of the default dimens.xml file. Do you write these basic dimen items by yourself?
I have already provided you with a template file, in the root directory of your project,
the screenMatch_example_dimens.xml file that is parallel to the screenMatch.properties configuration file.
You can rename this screenMatch_example_dimens.xml template file to dimens.xml and copy it to ...src/main/res/values,
or update the existing ...src/main/res/values/dimens.xml file content.

 

 

 

 

 

The latest and most complete article (2018-08-25): https://blog.csdn.net/fesdgasdgasdg/article/details/82054971

Guess you like

Origin blog.csdn.net/zhourui_1021/article/details/82981838