How to suppress warnings about me using px in xml layout?

I am working on a project that includes Sony SmartWatch , and when I submit layouts, I need to use real pixel values. [If you have not used on your watch, which are connected via bluetooth and work as an additional screen, the β€œcontrol” device can draw on]

I use Eclipse, so it gives a warning that I should not use px in the layout.xml file ... is there a way to suppress these warnings for lines where I know I should use px ? (note: I want to suppress these warnings only on those lines where, as I know, it should be used, so turning this check using the lint error check is not what I want)

And again, I know that px is usually a bad idea when working with android, but this is one of the few cases where it is necessary.

+6
source share
1 answer

Add xmlns:tools="http://schemas.android.com/tools" to your xml, then you can turn off px warnings by including this in your view: tools:ignore="PxUsage" .

This can be done automatically from the lint-warnings window by clicking the "Suppress this error using annotation / attribute" button.

+9
source

Source: https://habr.com/ru/post/914874/


All Articles