android开发文档中的一个小错误
16lz
2021-01-23
在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" android:id="@id+/textview"
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" android:id="@id+/textview"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:text="@string/hello"/>
在R.java文件里的确没有id->textview,头疼,不知道为什么,查了一下其他资料,突然发现一个问题:@+id是添加一个资源id,而这里却是:@id+。赶紧改过来,ok,编译通过了。程序运行正确。
更多相关文章
- 教你用电脑从 Google Play 下载 Android 程序 apk 文件
- Android获取keystore文件的信息
- Android学习笔记_布局文件属性的说明
- (4.1.25)android学习之布局
- 布局初步
- 我的android 第10天 - pull解析Xml文档
- Android布局及控件的属性说明