This property can tell lint to ignore the warning by setting the corresponding API version for the specified layout. minSdkVersion When lint gives the corresponding version warning. The minimum version of Android supported by the component elements we use is greater than the minimum version specified by our project. ![]() This property is similar to what we use in our code. tools:ignore="contentDescription" To ignore this warning. When using the ImageView tag, if not android:contentDescription Then lint will give contentDescription Related warnings,Īt this point, we can add it to the ImageView tag. Generally, in the case of a multi-language resource pack, if a String in strings.xml does not give a translation for another language version, then lint will give a warning message for MissingTranslation.Īnd through tools:ignore="MissingTranslation" We can let Lint ignore this warning for this String.Īnother example is the more common problem in our development: It can also be set by comma delimiter to set multiple question IDs to ignore. This attribute can be used to let lint ignore the warning by setting the corresponding problem ID in lint. In Lint, different IDs are defined for different problem warnings. We know that the lint tool is available in the Android development tools to help you easily identify and correct problem and structure quality code. #tools:ignore is suitable for any element Mainly used to help us control some of the error warnings generated by lint. Used in layout XML files tools: The properties added by the namespace, the tools property will be automatically removed by the build tool during the project build process, and will not have any impact on the build program.Īnd except for the preview function when writing the layout, tools: The namespace attribute also provides a lot of useful features, so let's take a closer look at these features of the tools property.Īccording to the official definition, the tools attribute is divided into three types: ![]() In response to the above problems, the Google official has long considered it, so the support of the tools namespace is provided in the development tools. Is it very troublesome, then do we have a simpler solution? It is often seen that some small partners do this by temporarily writing some data in the layout file to see the layout display effect, and then manually deleting the data after the viewing is finished. Layout effect, then how do you usually do this time? Therefore, in the process of writing the layout XML, due to the lack of data, it is difficult for us to directly see the data after filling. We know that in the Android development process, our data often comes from the server, and only when the runtime can get the data display.
0 Comments
Leave a Reply. |