在xml布局文件中使用Switch控件时,出现error: invalid symbol: ‘switch‘报错,代码如下:
<Switch
android:id="@+id/switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="开启"
android:textOff="关闭" />
原因是在设置其id时使用了关键字(如switch,case等),将其替换成非关键字即可。
关于在xml文件中的 error: invalid symbol: 'switch' 错误
原文:http://www.cnblogs.com/hackerkevin/p/4080278.html