Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout collides with a variable or import in Android?

Below is my xml where its giving me a warning.

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        android:tag="xlarge">

        .......

    </RelativeLayout>

</Layout>

Dont know what is the issue? and where its showing me that warning. But would love any help how it can be resolved. Tried searching for it on internet but couldn't find anything helpful.

Below is the warning that i am getting...

ERROR: View field thirdPartyLayout collides with a variable or import
like image 240
Darpal Avatar asked Dec 14 '22 09:12

Darpal


1 Answers

This could happen if your variable name conflicts with an ID tag, for example:

<?xml version="1.0" encoding="utf-8"?>
<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="thirdPartyLayout"
            type="String" />
    </data>

    <TextView
        android:id="@+id/thirdPartyLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</layout>

Resolution: rename one of them.

like image 77
atimb Avatar answered Jan 05 '23 13:01

atimb