我正在尝试构建android应用程序,但xml中有一个错误
错误为我正在尝试构建android应用程序,但xml中有一个错误,android,layout,android-linearlayout,Android,Layout,Android Linearlayout,错误为未指定方向,默认为水平方向。这是动态添加子项时常见的错误源。set <!-- Footer Start --> <LinearLayout android:id="@+id/footer" android:layout_width="fill_parent" android:layout_height="40dip" android:background="@layou
未指定方向,默认为水平方向。这是动态添加子项时常见的错误源。set
<!-- Footer Start -->
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="@layout/footer_repeat"
android:layout_alignParentBottom="true">
</LinearLayout>
<!-- Footer Ends -->
对于线性布局
添加到您的线性布局
:
android:orientation="vertical"
或
是一种扫描Android项目源代码以查找潜在bug的工具
您应该添加android:orientation=“horizontal”
或android:orientation=“vertical”
在LinearLayout
块中,即。重写为
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:orientation="horizontal"
android:background="@layout/footer_repeat"
android:layout_alignParentBottom="true">
</LinearLayout>
此线性布局是否包含任何子项?如果没有,则只需再次进行清理
和构建
,否则请放置一些方向
如android:orientation=“vertical”
或android:orientation=“horizontal”
android:orientation="horizontal"
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:orientation="horizontal"
android:background="@layout/footer_repeat"
android:layout_alignParentBottom="true">
</LinearLayout>
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="@layout/footer_repeat"
android:orientation="vertical"
android:layout_alignParentBottom="true">
</LinearLayout>
<!-- Footer Start -->
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="@layout/footer_repeat"
android:layout_alignParentBottom="true"
android:orientation="vertical" ><!-- or horizontal -->
</LinearLayout>
<!-- Footer Ends -->