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