布局与 Android 中的变量或导入发生冲突?

Dar*_*ani 4 layout android android-layout

下面是我的 xml,它给了我一个警告。

<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>
Run Code Online (Sandbox Code Playgroud)

不知道是什么问题?它向我展示了那个警告。但希望得到任何帮助来解决它。尝试在互联网上搜索它,但找不到任何有用的东西。

以下是我收到的警告...

ERROR: View field thirdPartyLayout collides with a variable or import
Run Code Online (Sandbox Code Playgroud)

ati*_*imb 9

如果您的变量名称与 ID 标签冲突,则可能会发生这种情况,例如:

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

Run Code Online (Sandbox Code Playgroud)

解决方法:重命名其中之一。


Rah*_*wal 0

这不是你的布局的问题。跟 是有关系的thirdPartyLayout。请检查链接。如果对您有帮助,请告诉我。