在android开发文档的HelloWorld小例子运行成功之后,文档接着介绍了android提供的另一种实现UI布局的方法:基于XML的布局文件。
按照文档中的步骤走下去,发现在main.xml文件中一直有一个错误:No source found that matches the given name...在android:id这行。
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" [color=red]android:id="@id+/textview" [/color]
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:text="@string/hello"/>
在R.java文件里的确没有id->textview,头疼,不知道为什么,查了一下其他资料,突然发现一个问题:@+id是添加一个资源id,而这里却是:@id+。赶紧改过来,ok,编译通过了。程序运行正确。
按照文档中的步骤走下去,发现在main.xml文件中一直有一个错误:No source found that matches the given name...在android:id这行。
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" [color=red]android:id="@id+/textview" [/color]
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:text="@string/hello"/>
在R.java文件里的确没有id->textview,头疼,不知道为什么,查了一下其他资料,突然发现一个问题:@+id是添加一个资源id,而这里却是:@id+。赶紧改过来,ok,编译通过了。程序运行正确。