读书人

奇怪的格局文件明明没错

发布时间: 2013-11-05 14:40:42 作者: rapoo

奇怪的布局文件,明明没错


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</LinearLayout>


Eclipse提示:第一句有误。
明明没错啊,这怎末一回事。
[解决办法]
我粘贴到我的eclipse,提示是正确的,你新建一个工程看看
[解决办法]
我在我这里测试也是正常的,楼主先保存,然后编译一下,还不行的话 先clean一下工程,再编译应该就没问题了。
[解决办法]
你不会看提示么,api18要求线性布局都要有oration..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

</LinearLayout>

[解决办法]
楼上说的应该靠谱,我也觉得是少了orientation 就是布局方向,是竖直还是横着
[解决办法]
布局默认是orientation,可能是电脑没反应过来,要不就是 从第一行,开始写起,或者格式化下catr+shift+f

读书人网 >Android

热点推荐