My understanding is that suppressing individual warnings can be done in XML by adding an ignore
property, e.g.
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="SpUsage"
android:textSize="30dp"
This works fine when the text size is directly specified. But when I use a reference to a dimension, e.g.
android:textSize="@dimen/largeTextSize"
Lint produces a warning in spite of the ignore.
Let's assume that the given case is a justified exception, and that the guidance on generally preferring sp
dimensions over dp
for text is well understood and followed.
Because this is an exception I do not want to disable the warning globally. How can I do it locally?
You need to add the suppression on the dimen
value resource:
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="largeTextSize" tools:ignore="SpUsage">123dp</dimen>
</resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With