Lint is warning me about API accesses not supported in all verions but it works everywhere?

StackOverflow https://stackoverflow.com/questions/10430275

Вопрос

Lint is giving me this error a fair amount of times:

"match_parent" requires API level 8 (current min is 4), use "fill_parent" instead

I understand the error. I'm using match_parent in all of the XML layouts my app uses and never use fill_parent cause it's deprecated. However, as you can understand from the error above, my minSdkVersion is 4 and match_parent is only available on 8.

The thing is, I ran my app on a Cupcake emulator and the app works just fine. Why? Shouldn't it crash or something?

What's the right way to work around this issue, ignore this specific Lint error for all the XML files or just put back fill_parent everywhere?

Это было полезно?

Решение

Why?

Because they have the same numerical value, and the value is what winds up in the APK file, not the symbol.

What's the right way to work around this issue, ignore this specific Lint error for all the XML files or just put back fill_parent everywhere?

For lint warnings where you know you are using the stuff correctly, you can add annotations in Java (and similar markers in XML) indicating that you know what you are doing, and lint will no longer complain.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top