Android – how to use mvximageview.defaultimagepath?

I have successfully used the mvximageview of imageurl, but how to set a drawable icon as the default value for those users who do not have a profilepicture (that is, the profilethumbnailimageurl is empty)?

<MvxImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"      
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    local:MvxBind="ImageUrl ProfileThumbnailImageUrl"
    DefaultImagePath="@drawable/ic_action_user"/>

resolvent:

If this view is used only once (e.g. not reused in the list), you can use Android: SRC as your default image

If you need to use defaultimagepath, you can do this in the binding:

 local:MvxBind="ImageUrl ProfileThumbnailImageUrl; DefaultImagePath DefaultImageUrl"

Where defaultimageurl is a drawable accessed with res: name - for example, res: IC_ action_ User, file path (saved using the file plug-in) or HTTP URL

You should also be able to do this as string Text:

 local:MvxBind="ImageUrl ProfileThumbnailImageUrl; DefaultImagePath 'res:ic_action_user'"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>