Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I suppress the warnings about me using px in a layout xml?

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.

like image 890
Jontas Avatar asked May 04 '12 08:05

Jontas


1 Answers

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.

like image 124
Jave Avatar answered Sep 21 '22 02:09

Jave