Android数据绑定-找不到类android.view.data

Marek M.

我试图在我的android应用程序中实现数据绑定,但是我遇到了以下问题:

java.lang.ClassNotFoundException: Didn't find class "android.view.data"

我的布局文件如下所示:

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.myapp.views.fragments.LocationSearchFragment">

        <!-- data setup -->
        <data>
            <variable name="location"
                type="com.myapp.models.Address" />
        </data>
    </LinearLayout>
</layout>

build.gradle用以下几行更新了文件:

dataBinding {
    enabled = true
}

根据文档建议:https : //developer.android.com/topic/libraries/data-binding/index.html我正在运行最新版本的Android Studio。

Earthw0rmjim

您需要将data定义放在您的之外LinearLayout

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <!-- data setup -->
    <data>
        <variable name="location"
            type="com.myapp.models.Address" />
    </data>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.myapp.views.fragments.LocationSearchFragment">
    </LinearLayout>
</layout>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

找不到带有Android注释的类

来自分类Dev

Android Studio找不到TestCase类

来自分类Dev

找不到类“ android.view.MapFragment”

来自分类Dev

java.lang.ClassNotFoundException:找不到类“ android.view.CardScrollView”

来自分类Dev

找不到Android Facebook LoginButton类

来自分类Dev

Android Junit-“找不到类”

来自分类Dev

在Android Studio中找不到符号类

来自分类Dev

数据绑定:找不到符号类BR

来自分类Dev

找不到Android ActionBar类

来自分类Dev

包android.support.v7.internal.view.menu不存在:找不到符号类MenuBuilder

来自分类Dev

Android数据绑定:找不到属性的设置器

来自分类Dev

android:数据绑定错误:找不到符号类

来自分类Dev

Android Studio许多错误:找不到类“ android.XXX”

来自分类Dev

Android-找不到方法onButtonClick(View)

来自分类Dev

Android数据绑定:在生成的数据绑定文件中找不到... BindingImpl

来自分类Dev

android中找不到类异常

来自分类Dev

找不到GoogleMap类Android Studio Gradle

来自分类Dev

Proguard android找不到引用的类

来自分类Dev

找不到Eclipse包android.view

来自分类Dev

Android数据绑定包含布局中的“找不到符号变量”

来自分类Dev

Android数据绑定不适用于View'android:tag'属性

来自分类Dev

找不到Android ActionBar类

来自分类Dev

Android Studio:找不到符号类

来自分类Dev

在Android Studio中找不到JDBC类

来自分类Dev

Android数据绑定-找不到类android.view.data

来自分类Dev

Android-找不到类ClusterManager?

来自分类Dev

[Android] Intent.ACTION_VIEW-找不到

来自分类Dev

Android数据绑定在Recycle View上无法正常工作

来自分类Dev

Android - 找不到以下类

Related 相关文章

热门标签

归档