Compiler won't allow | operator in XML


#1

Hi everyone,

I’m at listing 3.4, and I’m trying to enter ‘android:layout_gravity=“center_vertical | center_horizontal”’ into layout-land/activity_quiz.xml, but my compiler gives me this error: 'error: Error: String types not allowed (at ‘layout_gravity’ with value ‘center_vertical | center_horizontal’

Strange thing is, the graphical view version the XML page does seem to respond to the | being in the XML, it’s just that the compiler marks it as an error.

The same thing also happens in for ‘bottom | right’

Is this a problem with my compiler? Or am I just doing something wrong as I type it in?


#2

Remove the spaces around the pipe.

This: "no|spaces"
Not this: “no | spaces”