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>

更多相关文章

  1. 图解Android源代码下载指南
  2. Android(1.5及以上版本) 开机图片/文字/动画分析
  3. Android系统信息获取 之十三:Linux内核版本信息获取
  4. android 源代码获取
  5. Android仿百度谷歌搜索自动提示框AutoCompleteTextView简单应用
  6. 声波通信原理及源代码
  7. android apk版本更新
  8. Android ADK开发包示例开源代码
  9. Android属性动画应用超简单代码打造酷炫扇形(卫星),圆形菜单

随机推荐

  1. android 动态壁纸 2
  2. spring android 编译环境搭建
  3. android 动画
  4. android studio生成apk直接改名字
  5. Eclipse Indigo - Cannot install Androi
  6. android 添加 iconv 支持
  7. android中Textview如何限制在一行显示且
  8. Android强制让某个控件获得焦点
  9. android Material
  10. Android(安卓)Bundle类(简单实例)