Question

I am working with a project that includes a Sony SmartWatch and when I send layouts to that I need to use real pixel values. [If you haven't used on its a watch that is connected via bluetooth and works as an extra display the "controlling" device can draw to]

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

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

Was it helpful?

Solution

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top