Unexpected namespace prefix "xmlns" found for tag LinearLayout——android开发之xml布局文件
16lz
2021-01-23
android 2.2之前的版本 下面代码应该是对的(因为《在名师讲坛——android开发实战经典》这本书中示例代码就是在每个布局标签中都加了xmlns:android )。但是现在才用了android4.4的版本出现了错误,原因如下:新版本的android 一个namespace声明只要在xml中出现一次就可以了,多次出现就报错了。
例如:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" //加了这行之后出错 直接删除即可
android:orientation="horizontal">
<TextView
android:text="@string/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
更多相关文章
- 图解Android源代码下载指南
- Android(1.5及以上版本) 开机图片/文字/动画分析
- Android系统信息获取 之十三:Linux内核版本信息获取
- android 源代码获取
- Android仿百度谷歌搜索自动提示框AutoCompleteTextView简单应用
- 声波通信原理及源代码
- android apk版本更新
- Android ADK开发包示例开源代码
- Android属性动画应用超简单代码打造酷炫扇形(卫星),圆形菜单