创建一个android程序之后,发现xml文件头出现了这个错误:
Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where at least one has layout_width=match_parent
虽然问题不大,还是很经典,手动改了布局<LinearLayout>,但是没有写布局方向,在头文件属性中添加下面代码即可:
android:orientation="horizontal"。
发现错误没了。
我在程序中添加了一个按钮,但是运行后发现还是只有一行TextView,于是将代码改成:
android:orientation = "vertical"
问题解决!
上面的是横向代码,下面这个是纵向代码,线性排列需要给出横着排还是纵着排。
本文介绍了解决Android XML布局文件中出现的错误:“Wrong orientation? No orientation specified...”通过明确指定布局方向为横向或纵向,成功解决了布局显示不正确的问题。
3572

被折叠的 条评论
为什么被折叠?



