Android Studio白线遮挡代码问题求助:新手重建项目无效
Hey there! I totally get how annoying it is when a random white line blocks your code—especially when you’re still getting comfortable with Android Studio. Re-building the project didn’t work, so let’s walk through the most likely causes and fixes for this issue:
1. Misconfigured Indent Guides
This is the most common culprit. Sometimes the indent reference lines (which are usually thin, gray) get accidentally adjusted to thick white lines that overlap with your code.
- Open
File > Settings > Editor > General > Appearance(on Mac, it’sAndroid Studio > Settings > ...) - Find the Show indent guides option: uncheck it, click Apply, then re-check it. If that doesn’t fix it, click
Configure Indent Guidesnext to it, set the line width back to the default 1px, and pick a light gray color (like#cccccc) instead of white.
2. Third-Party Plugin Conflict
Some third-party plugins (especially code highlighting, formatting, or UI customization ones) can glitch out and render unexpected lines.
- Disable all non-official plugins first: Go to
File > Settings > Plugins, use theDisabledfilter to see active plugins, then disable any that aren’t made by Google/JetBrains. Restart Android Studio and check if the line is gone. - If it disappears, re-enable plugins one by one until you find the problematic one. You can either update that plugin to the latest version or uninstall it entirely.
3. Corrupted IDE Cache
Rebuilding your project only clears project-level cache—sometimes the IDE’s own cache gets corrupted and causes weird UI bugs like this.
- The easiest way is to use the built-in cache reset: Go to
File > Invalidate Caches..., check theInvalidate and Restartoption, then confirm. Wait for Android Studio to restart and re-index your project. - If that doesn’t work, you can manually delete the cache folder:
- Windows:
C:\Users\<YourUsername>\.AndroidStudio<Version>\system\caches - Mac:
~/Library/Caches/Google/AndroidStudio<Version> - Linux:
~/.AndroidStudio<Version>/system/caches
Delete the folder, then restart Android Studio.
- Windows:
4. Accidentally Enabled Column/Hard Wrap Guide
Sometimes a column boundary marker (set to wrap code at a specific line length) can look like a thick white line.
- Check
File > Settings > Editor > Code Style, select your language (Kotlin/Java), go to theWrapping and Bracestab. Look forHard wrap at—if it’s set to a low value (like 80), that might be the line you’re seeing. Either increase the value or uncheck the option if you don’t need it. - Also, check
Editor > General > Appearancefor the Show hard wrap guide option—uncheck it if it’s enabled and you don’t want that line.
内容的提问来源于stack exchange,提问作者Shubham Prince

