不允许的字符串类型(在值为 '@id/bAdd' 的 'id' 处) [英] String types not allowed (at 'id' with value ' @id/bAdd')

查看:21
本文介绍了不允许的字符串类型(在值为 '@id/bAdd' 的 'id' 处)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一条错误消息不允许的字符串类型(在 'id' 处,值为 '@id/bAdd')

  • 我已经清理了项目.
  • 之前一切正常,我不知道发生了什么,导致了这个错误.

  • I've cleaned the project.
  • Everything was working earlier, I don't what happened, causing this error.

 <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"
            ^^

这篇关于不允许的字符串类型(在值为 '@id/bAdd' 的 'id' 处)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆