The editor grays them out to remind you the code doesn't work in the current build platform you chose.
For example if in the editor you have chosen Android as the current build platform, it will gray out code that is on other platforms to remind you that this code only works on Android build.
Sometimes you'll write code for debug and testing, so you'll put it in UNITY_EDITOR so it only works in Unity editor.
When you write:
#if (UNITY_EDITOR && !UNITY_ANDROID)
// your code
#endif
it means the platform should be Unity editor and also shouldn't be android to let this code work. So you platform is not both of them. So it doesnt work.
If you only want it not to work on Android just write:
#if !UNITY_ANDROID
// your code
#endif
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-if