What does this Android Lint mean: "Wrong orientation?"

I run Android lint in eclipse and get an error:

Wrong orientation? The specified orientation is not specified, and horizontal by default, but there are several children in this layout, where at least one has layout_width = "match_parent"

Problem. Verifies that LinearLayouts with multiple children Orientation ID: Orientation

And this is the error code:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="@dimen/cell_height_1_of_3" > <ImageView android:id="@+id/item_cover" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="left" android:layout_marginLeft="8dp" android:scaleType="fitCenter" android:src="@drawable/doc_item_icon" /> <ImageView android:layout_width="fill_parent" android:layout_height="@dimen/cell_height_1_of_3" android:background="#0000" android:padding="5dp" android:scaleType="centerInside" android:visibility="gone" /> <TextView android:id="@+id/item_title" android:layout_width="fill_parent" android:layout_height="fill_parent" android:ellipsize="end" android:gravity="center" android:maxLines="1" android:text="Add new" android:textColor="@color/office_color" android:textSize="@dimen/textview_small_size" /> </LinearLayout> 

What does it mean? What happens if I ignore this lint error?

+7
source share
2 answers

Android Lint is a new tool introduced in ADT 16 (and Tools 16) that scans Android project sources for potential errors.

http://developer.android.com/tools/help/lint.html

You must specify the orientation for your layout.

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:orientation="vertical" //specify vertical or horizontal depending on your need android:layout_height="@dimen/cell_height_1_of_3" > 

http://tools.android.com/tips/lint-checks . list of checks performed by lint.

+16
source

If you did not specify an orientation in LinearLayout, then 2 ImageViews and TextView will be displayed next to each other.

 android:orientation="horizontal" 

will be considered

If you want them to appear below each other, use

 android:orientation="vertical" 
+1
source

All Articles