我希望能够实现自定义函数来从
ImageView
中下载图片,类似于下面代码中的app:imageUrl="@{status.imageUrl}"
:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="status"
type="com.databinding.data.Status" />
</data>
<RelativeLayout
android:id="@+id/status_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/status_avatar"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:contentDescription="@null"
app:imageUrl="@{status.imageUrl}"/>
</RelativeLayout>
</layout>
如何编写一个函数,可以自动从@{status.imageUrl}
下载图片?使用这个库com.android.databinding
。