I'm running Android lint in eclipse and get a error:
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"
Issue: Checks that LinearLayouts with multiple children set the 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 will happen if I ignored this lint error?
Android Lint is a new tool introduced in ADT 16 (and Tools 16) which scans Android project sources for potential bugs.
http://developer.android.com/tools/help/lint.html.
You have to specify 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 the checks performed by lint.
If you didn't specify orientation in the LinearLayout the 2 ImageViews and the TextView will be rendered beside each other
android:orientation="horizontal"
will be assumed
If you want them to be rendered below each other then use
android:orientation="vertical"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With