相关疑难解决方法(0)

什么是双向绑定?

我已经阅读了很多,Backbone没有做双向绑定,但我并不完全理解这个概念.

有人能给我一个例子,说明双向绑定如何在MVC代码库中运行,以及它如何与Backbone无关?

javascript data-binding backbone.js

160
推荐指数
4
解决办法
10万
查看次数

与元素类型"变量"关联的Android-Binding"type"不得包含"<"字符

我收到以下错误:与元素类型"变量"关联的属性"type"的值不得包含"<"字符.

并且type ="ObservableField"/>在xml中显示为红色.

有任何想法吗?

 <?xml version="1.0" encoding="utf-8"?>
 <layout>

<data>

<import type="android.databinding.ObservableField"/>
<variable name="field" type="ObservableField<String>"/>

</data>

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="72dp"
    android:text="@{field.get()}"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="181dp"
    android:layout_marginEnd="149dp"
    android:layout_marginStart="147dp"
    android:layout_marginTop="191dp"
    android:text="Button"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView" />

</android.support.constraint.ConstraintLayout>

</layout>
Run Code Online (Sandbox Code Playgroud)

data-binding android

4
推荐指数
2
解决办法
993
查看次数

标签 统计

data-binding ×2

android ×1

backbone.js ×1

javascript ×1