In some cases I want to disable scroll on my ScrollView.
To do that I'm using .setOnTouchListener
and return true
in onTouch
.
3.0 studio gives me lint warning that I should override performClick
method also and I don't wanna do that.
When I hit alt+enter
it gives me an option to supress this warning, it adds @SuppressLint("ClickableViewAccessibility")
to my method.
Unfortunately, this is not working - I still see that warning.
I also tried different combinations of //noinspection
, but no luck.
How can I supress this lint warning?
I have noticed the same that neither the annotation
@SuppressLint("ClickableViewAccessibility")
nor the inline suppression
//noinspection AndroidLintClickableViewAccessibility
work reliably. The latter does suppress the warning when working in Android Studio IDE, but does not suppress it when running Lint as Gradle task.
So far the only suppression method that works both in Android Studio and with Lint Gradle task is to combine the inline suppression
//noinspection AndroidLintClickableViewAccessibility
someView.setOnTouchListener(...)
with the Lint configuration file (that works on file granularity), e.g. in build.gradle
:
lintOptions {
lintConfig file("lint.xml")
}
and in lint.xml
:
<lint>
<issue id="ClickableViewAccessibility">
<ignore path="**/TheClassToSuppressTheWarningIn.java"/>
</issue>
</lint>
For what it's worth, there's an issue reported and it should be fixed in Android Studio 3.1.
Update 2018-03-28: Yes, it's fixed in Android Studio 3.1.
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