在布局文件/layout中加的id,在R文件中却没有显示?

新建android工程,在/layout/activity_main.xml文件中,新建了一个Button,

<Button
        android:id="@+id/person"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/person" />

但是,该ID资源person却没有在MainActivity中调用出来,

person=(Button)this.findViewById(R.id.person);

查看/R.java文件也没有找到对应的ID资源;

此时,解决办法是:

Project->Build All后 自动生成。

posted @ 2015-05-24 14:56  lonsine  阅读(357)  评论(0编辑  收藏  举报