2016-11-16 9 views
0
私はMvxRecyclerViewとandroid.support.v4.widget.SwipeRefreshLayoutを中心に展開し、問題に遭遇してきた

こんにちはMvvmCross/XamarinのDev、スワイプ更新レイアウトは、リサイクルの項目テンプレート

を破ります。

  • Xamarinバージョン:7.0.1.3(Xamarinビジネス)
  • SDKツールのバージョン:25.1.7
  • SDK Platformツールのバージョン:24.0.1
  • SDKビルドツールこの問題は、使用してAndroid上で発生しましたバージョン:23.0.3
  • MvvmCross V4.3.0。

ここでは何が起こっているのですか。私は観測可能なコレクションにバインドされ、カスタムテンプレートを持っているMvxRecyclerViewを持っています。また、私たちがリストの一番下に来たときにTemplateSelectorを使って "ロードセル"を表示しています。 MvxRecyclerListはandroid.support.v4.widget.SwipeRefreshLayoutにラップされ、スワイプからリフレッシュパターンを実装します。

結果がリストに読み込まれると、結果が表示されます。リストに戻ると戻ります。セルテンプレートのレイアウトは、必要なだけ正確に表示されます。ご覧のとおり、下記の通りです。

enter image description here

しかし、私はリフレッシュするためにプルを行うと、私は最終的にレイアウトを返すために待っているデータが「壊れた」で、すべてがそこにあるが、それはめちゃくちゃだ。ときそれが十分奇妙ではありませんかのように、スワップ毎回壊れている細胞は、あなたがリフレッシュするプルを行う

enter image description here

の下を参照してください。時にはなし

enter image description here

が壊れています。追加する最後のことは、細胞がリサイクルされたときに細胞を修復することです。

私はMvxRecyclerViewがSwipeRefreshLayoutにラップされているという事実に絞っています。そこには、一度盗んだセルがなくてもreload関数を何度も呼び出すことができます。

これに関する助けや指針をいただければ幸いです。

UPDATE:ItemTemplateにのXml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:local="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="#fff"> 
<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="100dp"> 
    <Mvx.MvxImageView 
     android:id="@+id/car_item_template_image_view" 
     android:layout_width="80dp" 
     android:layout_height="80dp" 
     android:layout_gravity="center_vertical" 
     android:layout_marginLeft="10dp" 
     android:scaleType="centerCrop" 
     android:background="@drawable/image_placeholder" 
     local:MvxBind="ImageUrl MainImageUrl" /> 
    <RelativeLayout 
     android:orientation="vertical" 
     android:background="@color/white" 
     android:layout_width="fill_parent" 
     android:layout_height="80dp" 
     android:layout_marginLeft="10dp" 
     android:layout_gravity="center_vertical"> 
     <TextView 
      android:id="@+id/car_item_template_make_text" 
      android:text="Make" 
      android:layout_width="wrap_content" 
      android:layout_height="25dp" 
      android:textColor="@color/theme_blue" 
      android:fontFamily="sans-serif-light" 
      android:textSize="@dimen/car_item_template_title_text_size" 
      local:MvxBind="Text Make, Converter=EmptyStringCheck" 
      android:ellipsize="end" 
      android:singleLine="true" /> 
     <TextView 
      android:text="Model" 
      android:layout_width="@dimen/car_item_template_model_text_width" 
      android:layout_height="25dp" 
      android:layout_marginLeft="7dp" 
      android:textColor="@color/theme_blue" 
      android:layout_toRightOf="@id/car_item_template_make_text" 
      android:layout_toLeftOf="@+id/car_item_template_price_text" 
      android:fontFamily="sans-serif-light" 
      android:textSize="@dimen/car_item_template_title_text_size" 
      local:MvxBind="Text Model, Converter=EmptyStringCheck" 
      android:ellipsize="end" 
      android:singleLine="true" /> 
     <TextView 
      android:id="@+id/car_item_template_price_text" 
      android:text="Price" 
      android:layout_alignParentRight="true" 
      android:layout_alignTop="@+id/car_item_template_make_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="15dp" 
      android:textColor="@color/theme_blue" 
      android:fontFamily="sans-serif-light" 
      android:textSize="@dimen/car_item_template_title_text_size" 
      local:MvxBind="Text Price, Converter=IntToPrice" /> 
     <TextView 
      android:id="@+id/car_item_template_year_text" 
      android:layout_alignParentLeft="true" 
      android:layout_above="@+id/car_item_template_mileage_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Year" 
      android:textSize="@dimen/car_item_template_detail_text_size" 
      local:MvxBind="Text Year, Converter=EmptyShortCheck, ConverterParameter='No Year'" /> 
     <TextView 
      android:id="@+id/car_item_template_mileage_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_above="@+id/car_item_template_location_text" 
      android:layout_alignParentLeft="true" 
      android:text="Mileage" 
      android:textSize="@dimen/car_item_template_detail_text_size" 
      local:MvxBind="Text Mileage, Converter=IntToMileage, ConverterParameter='No Mileage'" /> 
     <TextView 
      android:id="@+id/car_item_template_location_text" 
      android:text="Location" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentLeft="true" 
      android:textSize="@dimen/car_item_template_detail_text_size" 
      local:MvxBind="Text Location, Converter=EmptyStringCheck, ConverterParameter='No Location'" /> 
    </RelativeLayout> 
</LinearLayout> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="1dp" 
    android:layout_alignParentBottom="true" 
    android:background="@drawable/generic_graydivider" /> 
</RelativeLayout> 
+0

あなたの項目テンプレートを投稿してください。 – Cheesebaron

+0

@Cheesebaronは質問を更新しました。で追加されましたテンプレートxml –

+0

@Cheesebaron私は現在、回避策を行っています。下記の回答を参照してください。それでも何が原因か分かりません。 –

答えて

0

だから、これは問題の回避策です。上のテンプレートでわかるように、TextViewsの幅はすべてwrap_contentに設定されています。私はそれを固定値に変更し、問題はもう発生していません。

残念ながら私はまだSwipeRefreshLayoutに含まれているときに、リストがこのように応答するために引き起こしているかわからない:(しかし、これは今のところ行います。

関連する問題