title: RecyclerView item with different height
body: <p>I want to implement RecyclerView with different item height. Item contains  NetworkImageView. I set for NetworkImageView <code>layout_height="wrap_content"</code> and for all parent of NetworkImageView. But I am faced with an issue. When scrolling and reaching the end, and then scrolling up I get strange behavior of RecyclerView. And sometimes some images do not show. But I noticed if I set NetworkImageView <code>layout_height</code> to some specific value it's working fine. <br><br> This is list_row.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
  
      &gt;
      &lt;android.support.v7.widget.CardView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/cv"
          android:background="#FFFFFF"
          android:layout_marginLeft="15dp"
          android:layout_marginRight="15dp"
          android:layout_marginBottom="7dp"
          android:layout_marginTop="7dp"
          card_view:cardCornerRadius="2dp"
          card_view:cardElevation="1dp"
          card_view:cardBackgroundColor="#FFFFFF"
  
          &gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
                  &lt;TextView
                      android:id="@+id/title"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_margin="13dp"
                      android:textColor="#000000"
                      android:text="Получайте бонусы от нашей компании"
                      android:textStyle="bold"/&gt;
  
                  &lt;com.android.volley.toolbox.NetworkImageView
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:id="@+id/image_net"
                      android:src="@drawable/wait"
                      android:layout_marginLeft="13dp"
                      android:layout_marginRight="13dp"
                      android:adjustViewBounds="true"
                      /&gt;
                  &lt;TextView
                      android:id="@+id/details"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_margin="13dp"
                      android:textColor="@android:color/holo_red_light"
                      android:text="@string/tv_under"/&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><br><br> RecyclerView.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".fragments.A_Fragment"
      android:background="#E8E8E8"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/rv"
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><br><br> RecyclerViewAdapter</p>
  
  <pre><code>public class NewsAdapter extends RecyclerView.Adapter&lt;NewsAdapter.PrudactViewHolder&gt; {
  
  List&lt;HashMap&lt;String,String&gt;&gt; newsList;
  public Context mContext;
  public static ItemAdd add;
  public static FragmentListItemClick fragmentListItemClick;
  ImageLoader imageLoader = AppController.getInstance().getImageLoader();
  
  public NewsAdapter(List&lt;HashMap&lt;String,String&gt;&gt; news, Context context){
      this.newsList = news;
      this.mContext = context;
  
  }
  
  public NewsAdapter(){
  
  }
  
  @Override
  public PrudactViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View  v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_of_news, parent, false);
      PrudactViewHolder pvh = new PrudactViewHolder(v,mContext);
      return pvh;
  }
  
  
  @Override
  public void onBindViewHolder( PrudactViewHolder prudactViewHolder, int i) {
  
      /*NewsModel newsModel = newsList.get(i);
      prudactViewHolder.title.setText(String.valueOf(newsModel.getTitle()));
      prudactViewHolder.description.setText(String.valueOf(newsModel.getDescription()));
      prudactViewHolder.thumbNail.setDefaultImageResId(R.drawable.wait);
     prudactViewHolder.thumbNail.setImageUrl(newsModel.getId_image(), imageLoader);*/
  
      if (imageLoader == null)
          imageLoader = AppController.getInstance().getImageLoader();
      HashMap&lt;String,String&gt; news = newsList.get(i);
      prudactViewHolder.title.setText(news.get(A_Fragment.TITLE));
      //prudactViewHolder.description.setText(news.get(A_Fragment.DESCRIPTION));
      if (news.get(A_Fragment.IMG_URL)!=null)
      prudactViewHolder.thumbNail.setImageUrl(news.get(A_Fragment.IMG_URL), imageLoader);
      else prudactViewHolder.thumbNail.setImageUrl(news.get(A_Fragment.IMG_URL), imageLoader);
  
  }
  
  @Override
  public void onAttachedToRecyclerView(RecyclerView recyclerView) {
      super.onAttachedToRecyclerView(recyclerView);
  }
  
  
  @Override
  public int getItemCount() {
  
      return newsList.size();
  }
  
  public static class PrudactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
  
  
      TextView title,description;
      NetworkImageView thumbNail;
  
      public PrudactViewHolder(View itemView,Context context) {
          super(itemView);
  
          title = (TextView)itemView.findViewById(R.id.title);
          description = (TextView)itemView.findViewById(R.id.details);
          thumbNail = (NetworkImageView) itemView
                  .findViewById(R.id.image_net);
  
          description.setOnClickListener(this);
  
      }
  
      @Override
      public void onClick(View v) {
  
          A_Category_B a_category_b = new A_Category_B();
          fragmentListItemClick.itemClicked(a_category_b);
  
      }
  }
  
  @Override
  public int getItemViewType(int position) {
      return super.getItemViewType(position);
  }
  
  
  public void setfragmentclick(FragmentListItemClick fr){
      fragmentListItemClick = fr;
  }
  }
  </code></pre>
  
  <p>And Place where I use it</p>
  
  <pre><code> public static final String TITLE = "title";
      public static final String DESCRIPTION = "des";
      public static final String IMG_URL = "img_url";
  
      NewsAdapter adapter;
      RecyclerView rv;
  
      ArrayList&lt;HashMap&lt;String,String&gt;&gt; data =  new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_a, container, false);
          rv = (RecyclerView) view.findViewById(R.id.rv);
  
          setHasOptionsMenu(true);
          data.clear();
          HashMap&lt;String, String&gt; hm1 = new HashMap&lt;String, String&gt;();
  
          // some code
         data.add(h1);
         data.add(h2);
         data.add(h2);
  
  
          adapter = new NewsAdapter(data,getContext());
          LinearLayoutManager llm = new LinearLayoutManager(rv.getContext());
          rv.setLayoutManager(llm);
          rv.setHasFixedSize(true);
          rv.setAdapter(adapter);
          return view;
      }
  }
  </code></pre>