代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://shemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/send" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Connect Socket Server" />
<TextView android:id="@+id/info" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Waiting for server" />
</LinearLayout>
部署运行后出现下面的异常:
异常提示需要添加layout-width 属性,但从代码中可以看到所有的节点都有layout-width属性,不止为何依然会报此异常。
求解答。。。。。。。。
第一行的 最开头有个空格 , 请删除, 布局文件里面 <?xml version="1.0" encoding="utf-8"?> 注意: 必须在第一行并且不能有空格
xmlns:android="http://shemas.android.com/apk/res/android" 删除掉,然后在 android:orientation="vertical" andro id:layout_width="fill_parent上面输入id 快捷键提示出来 ,这时会自动 添加一行xmlns:android="http://shemas.android.com/apk/res/android" 然后保存就可以了