Kathryn Crawford
Kathryn Crawford

Reputation: 611

Error when trying to use <include in xml file

I am trying to include some xml layouts in another xml layout file and I am getting this error "The value of attribute "layout" associated with an element type "include" must not contain the '<' character." This is the first time I have done include so I have no clue. Here is the file where I am trying to use include.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical|center_horizontal"
        android:orientation="horizontal">

    <include layout="@layout/water" />
    <include layout="@layout/espresso />

     </LinearLayout>
</LinearLayout>

and here is one of the layouts I am including

     <ImageView android:id="@+id/water" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_weight="1"
                android:src="@drawable/water"
                android:scaleType="centerInside" />

Upvotes: 0

Views: 931

Answers (1)

MByD
MByD

Reputation: 137282

You forgot the quote:

<include layout="@layout/espresso" />
                                 ^

Upvotes: 1

Related Questions