如何恢复Android Studio中API等级字段的背景色与弹窗提示效果?
Hey, I’ve totally been in your shoes—accidentally turning off that super helpful API level highlighting is such a pain, especially when you’ve got tons of custom IDE settings you don’t want to mess with. Let’s get this fixed quickly:
First, fire up Android Studio’s settings:
- Windows/Linux: Hit
File > Settings(or use the shortcutCtrl+Alt+S) - macOS: Go to
Android Studio > Settings(shortcutCmd+,)
Step 1: Re-enable the API Level Inspection
- In the settings search bar, type "API" to narrow down the relevant options fast.
- Navigate to
Editor > Inspections > Android Lint > Compatibility. - Look for the inspection called "New API"—this is the one that triggers the "Field requires API level xx" hover tip and the background highlighting.
- Make sure the checkbox next to it is checked.
Step 2: Restore the Background Color (if needed)
If the highlighting still doesn’t show up after enabling the inspection, you’ll need to check the color scheme settings:
- In settings, go to
Editor > Color Scheme > Android Lint. - Find the "New API" entry in the list.
- Check the "Background" box, and you can even adjust the color to your preference (the default is a soft yellow/orange). Tweak the opacity if you want it more or less noticeable.
Click "Apply" then "OK", and you should see those familiar highlighted fields right away. Hovering over them will bring back that crucial version info tooltip too.
Quick side note: If you ever accidentally disable inspections again, you can right-click in the editor, use the Alt+Enter (Windows/Linux) or Option+Enter (macOS) quick fix menu to re-enable specific checks without digging through settings.
内容的提问来源于stack exchange,提问作者BK K

