这篇文章主要介绍android – 不允许字符串类型(‘id’的值为’@id / bAdd’), 对于目前你搜索查找的问题还是具有很好的参考价值,希望编程之家小编整理的这个内容对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教。
编程之家(jb51.cc)小编说:我收到一个错误说 不允许使用字符串类型(‘id’的值为’@id / bAdd’) >我已经清理了这个项目. >一切都工作得更早,我不会发生什么事,导致这个错误. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
我收到一个错误说
不允许使用字符串类型(‘id’的值为’@id / bAdd’)
不允许使用字符串类型(‘id’的值为’@id / bAdd’)
>我已经清理了这个项目.
>一切都工作得更早,我不会发生什么事,导致这个错误.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Your total is 0" android:textSize="45dp" android:layout_gravity="center" android:gravity="center" android:id="@+id/tvdisplay" tools:context=".StartingPoint" /> <Button android:layout_width="250dp" android:layout_height="wrap_content" android:text="Subtract One" android:layout_gravity="center" android:textSize="20dp" android:id="+@id/bSub" /> <Button android:layout_width="250dp" android:layout_height="wrap_content" android:text="Add One" android:layout_gravity="center" android:textSize="20dp" android:id="+@id/bAdd" />
解决方法
您可以将您的ID设为@ id / bAdd
而不是@ id / bAdd
也编辑
android:id="@+id/bSub" ^^
代替
android:id="+@id/bSub" ^^