2013-04-30 58 views
5

我想在Android上使用Xamarin.Android和mvvmcross在列表視圖中綁定Web圖像。雖然我收到了這個錯誤。MvvmCross MvxHttpImageView錯誤

MvxBind:錯誤:7.13視圖類型未發現 - Mvx.MvxHttpImageView Android.Views.InflateException:二進制XML文件行#1:錯誤充氣類Mvx.MvxHttpImageView

這是我axml ...

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:local="http://schemas.android.com/apk/res/com.mynamespace.android" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

    <Mvx.MvxHttpImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/iconeView" 
        local:MvxBind="{'HttpImageUrl':{'Path':'imageUrl'}}" /> 
    <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="30dp" 
      local:MvxBind="Text name" /> 
    <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="10dp" 
      local:MvxBind="Text tagline" /> 
</LinearLayout> 

回答

10

如果使用的是V3,然後嘗試

  • MvxImageView代替MvxHttpImageView
  • ImageUrl,而不是HttpImageUrl

https://github.com/slodge/MvvmCross/tree/v3/Cirrious/Cirrious.MvvmCross.Binding.Droid/Views

我覺得MvxImageView中還討論了束縛的觀點:http://slodge.blogspot.co.uk/2013/04/n2-lists-and-kittens-n1-days-of.html

您還需要包括MvvmCross文件和DownloadCache插件,否則你會得到這個錯誤

"No IMvxImageHelper registered - you must provide an image helper before you can use a MvxImageView"

+1

舊的json語法在默認情況下在v3中是禁用的 - 所以這個語法在本地不起作用:MvxBind =「{'HttpImageUrl':{'Path':'imageUrl'}}」 – Stuart 2013-04-30 05:11:34