Android Lint Frequently Asked questions check

Source: Internet
Author: User
Tags deprecated

1. Correctness 1) duplicatedids layout on the ID should be unique 2) Some APIs used in NEWAPI code are higher than the Min SDK 3 in manifest) Inconsistentarrays string internationalization 。  The String-array corresponding item value of the same name is not the same 4) registered Activity/service/contentprovider did not pass the Androidmanifest Register 5) Deprecated Use deprecated API 6) Pxusage avoid using PX. Use DP 2. Correctness:messeges 1) Missingtranslation string internationalization not totally 2) extratranslation internationalized string, in default position (Defaultlocale), undefined 3. Security 1) setjavascriptenabled Not sure if you really need JavaScript in your program to run setjavascriptenabled.

2) exportedcontentprovider/exportedreceiver/exportedservice/exportedactivity contentprovider/receiver/service/ When the activity's exported is true. Set a permission. Let the user obtain permission talent use.

3) Hardcodeddebugmode do not set the android:debuggable in the manifest. Set it up, regardless of the version number compiled with the specified debug mode. Do not set, compile Eng version number with debug mode, compile user version number with release mode. 4. Performance 1) Drawallocation avoid assigning objects when plotting or parsing layouts (draw/layout).

The Paint object is instantiated in

E.g.,ondraw (). 2) Obsoletelayoutparam The unused number of references in layout. 3) Usecompounddrawables optimized layouts: include a imageview and a textview linear layout, which can be replaced by compounddrawable TextView. 4) Usesparsearrays try to replace HashMap 5 with Android Sparsearray) Disablebaselinealignment assuming LinearLayout is used for nested layout space calculations, Its Android:baselinealigned property should be set to false to speed up layout calculations.

6) Floatmath replace math with Floatmath. 7) Nestedweights Avoid nesting weight. That will drag the operating efficiency 8) Unusedresources/unusedids unused resources will be the program becomes larger and the compilation speed is reduced. 9) Overdraw assumes that a background drawable is specified for Rootview, which is drawn first with the background of the theme, before using the specified background, which is called "Overdraw". The ability to set theme background is NULL to avoid. Uselessleaf/uselessparent view or view of the father is not practical 5. Usability:typography 1) typographydashes special characters need to be replaced by code: "–" Required "–"; "-" need to use "-" 2 "typographyellipsis special characters required to replace:" ... " 3) Typographyother question: "(c)" need to use "©" 6. Usability:icons 1) iconnodpi icon appears under NODPI and at the specified DPI folder. 2) Gifusage image do not use GIF, preferably with PNG, can be used jpg. 7. Usability 1) Backbutton Android do not design have back button,android in general have back hard keys. 2) The "OK"/"Cancel" of the Buttoncase button shows uppercase and lowercase must not be all uppercase or lowercase.

A string of standard resources, not to be defined by itself, but to be defined by the system: @android: String/ok and @android:string/cancel 8. Accessibility 1) ContentDescription ImageView and ImageButton should provide contentdescription 9. Internationalization 1) Hardcodetext hard-coded strings should be defined in the resource 2) EnforceUTF8 the entire XML resource file should UTF-8 encoded



Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.

Android Lint Frequently Asked questions check

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.