To remove the coloured squares (Also known as inspections) you either need to solve the reason Android Studio has alerted you to that piece of code with a warning/error; or disable the inspections.
To disable one off/singular inspections:
- Go to the part of the code which shows the warning/error
- Press alt + enter on keyboard
- Click "disable inspection"
- That specific inspection should disappear
To disable all inspections:
- Go to settings, then editor, then inspections
- You should see a list of all inspections, here you can edit what ones you want, and how they behave
- To turn off an inspection, un-check its tick-box to the right side of the list
- To turn off all inspections, just un-check all tick-boxes