小编Bri*_*anM的帖子

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

我正在尝试使用示例项目 android-sunflower 对视图模型进行数据绑定。当前的问题是,当我尝试构建项目时,我error: cannot find symbol symbol: class FragmentShopBindingImpl location: package {{packageName}}.databinding在类中遇到错误,DataBindinMapperImpl 我不确定我在这里缺少什么,因为我添加了示例项目中的所有内容。该类FragmentShopBindingImpl没有生成,或者不应该生成?由于我在 android 向日葵示例中看不到任何以“Impl”结尾的类的出现
我的代码:

override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {

        val factory = InjectorUtils.provideShopViewModelFactory(context!!)
        val shopViewModel = ViewModelProviders.of(this, factory)
            .get(ShopViewModel::class.java)

        val binding = DataBindingUtil.inflate<FragmentShopBinding>(
            inflater, R.layout.fragment_shop, container, false).apply {
            viewModel = shopViewModel
            lifecycleOwner = this@ShopFragment
        }

        return binding.root
    }
Run Code Online (Sandbox Code Playgroud)

布局:

<?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="viewModel"
            type="{{packageName}}.viewmodel.ShopViewModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".fragments.ShopFragment"> …
Run Code Online (Sandbox Code Playgroud)

data-binding android kotlin android-databinding android-jetpack

8
推荐指数
2
解决办法
1万
查看次数

从Angular 5更新到6后,我不断收到错误:无法解析xml2js中的计时器

就像标题所说,我继续得到这个奇怪的错误.我也尝试使用npm uninstall xml2js卸载它,但直到现在还没有任何工作.

在此输入图像描述

npm xml2js angular angular5 angular6

7
推荐指数
1
解决办法
5469
查看次数

setAttribute使属性名称小写

我使用创建元素,var l = document.createElement("label");并使用分配其属性l.setAttribute("formControlName","e");。问题在于setAttribute方法将formControlName转换为小写字母,如下图所示。我与ionic一起工作,因此需要使用大写字母。有人看到我做错了吗?

在此处输入图片说明

在此处输入图片说明

html javascript forms dom typescript

5
推荐指数
1
解决办法
826
查看次数

更改 getElementsByClassName 的样式会导致编译错误

我试图更改通过调用 getElementsByClassName 方法收到的所有元素的样式。问题是,它在之前编译过时确实可以工作(我注释掉这些行以使其编译),它只是说 cmd 中的错误。编译后,我只是将线路恢复正常,它们不断给出错误,但在浏览器中正常工作。对这种奇怪的行为有什么想法吗?

在此输入图像描述

在此输入图像描述

注释掉时:

在此输入图像描述

当没有评论并给出错误时:

在此输入图像描述

html javascript css typescript angular5

3
推荐指数
1
解决办法
2485
查看次数