Win*_*Oak 10 android android-gradle-plugin android-databinding
在构建项目时,我看到以下编译器警告:
warning: Method references using '.' is deprecated. Instead of 'item.onCardClicked', use 'item::onCardClicked'
我使用android插件gradle 2.1.0.
我的布局文件如下所示:
<layout 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">
<data>
<variable
name="item"
type="com.example.Card"/>
</data>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="@{item.onCardClicked}"/>
...
</LinearLayout>
</layout>
Run Code Online (Sandbox Code Playgroud)
有人能指出我正确的方向来解决这个警告吗?
ian*_*ake 10
根据错误消息:
警告:使用'.'的方法引用 已弃用.而不是'item.onCardClicked',使用'item :: onCardClicked'
因此,更换@{item.onCardClicked}
用@{item::onCardClicked}
归档时间: |
|
查看次数: |
1631 次 |
最近记录: |