I keep getting an error in my abc_action_bar_decor_overlay.xml.

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""

    <LinearLayout android:id="@+id/top_action_bar"   <---error
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="top">

    <android.support.v7.internal.widget.ActionBarContainer
        android:id="@+id/action_bar_container"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:layout_alignParentTop="true"
           style="?attr/actionBarStyle"
           android:gravity="top">
有帮助吗?

解决方案

A LinearLayout must have the attribute android:orientation as follows:

<LinearLayout 
    android:id="@+id/top_action_bar"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top" >  

This attribute provides the direction of the children views, see:

vertical (a row)

<LinearLayout>
    [View 1]
    [View 2]
    [View 3]
</LinearLayout>

horizontal (a column)

<LinearLayout> [View 1] [View 2] [View 3] </LinearLayout>

其他提示

Its probably from Lint Error Checking.

Here is how I did it for this Wrong Orientation error(eclipse):

1) Window -> Preferences -> Android - Lint Error Checking.

2) In Search box 'Issues', type Orientation -> select the row

3) Set 'Severity' from dropdown to 'Warning'


Project -> Clean.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top