I am trying to use the and "&&" operator in xml using Android databinding,
android:visibility="@{(bean.currentSpaceId == bean.selectedSpaceId **&&** bean.currentSpaceId > 0)? View.VISIBLE: View.GONE}"
but I got the compilation error:
Error:Execution failed for task ':app:dataBindingProcessLayoutsDevDebug'.
org.xml.sax.SAXParseException; systemId: file:/Users/path/app/build/intermediates/res/merged/dev/debug/layout/fragment_space.xml; lineNumber: 106; columnNumber: 89; The entity name must immediately follow the '&' in the entity reference.
and red highlight error in android studio "unescaped & or non terminated character".
So how should I fix this?
Edit:
found the answer, these character needs to be escaped:
'&' --> '&'
'<' --> '<'
'>' --> '>'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…