title: View.gone showing empty space in Recyclerview android
body: <p>I am using recyclerview for showing data from web service. Based on particular condition i need to remove the particular recycler view item. So i am using View.Gone. But it is showing empty space. I googled about this issue and set the height to wrapcontent, but it is not working. Please any one help me.</p>
  
  <p>my code:
  xml: item</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/businfo"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="wrap_content"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:cardCornerRadius="4dp"
          app:contentPaddingBottom="10dp"
          app:contentPaddingTop="16dp"
          android:elevation="10dp"
          android:layout_margin="5dp"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"&gt;
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="2"
          android:orientation="horizontal"&gt;
          &lt;TextView
              android:id="@+id/travel_name"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:textSize="14sp"
              android:layout_marginLeft="5dp"
              android:textColor="@color/holo_blue_light"
              android:text="CGR Travels"/&gt;
  
  
          &lt;TextView
              android:id="@+id/bus_price"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:gravity="right"
              android:textSize="14sp"
              android:textColor="#F04C3B"
              android:layout_marginRight="30dp"
              android:text="Rs.349"/&gt;
  
  
      &lt;/LinearLayout&gt;
      &lt;View
          android:layout_width="match_parent"
          android:layout_height="0.5dp"
          android:layout_marginTop="5dp"
          android:background="#b6b6b6"/&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="2"
          android:layout_marginTop="5dp"
          android:orientation="horizontal"&gt;
  
          &lt;TextView
              android:id="@+id/arrtime_desttime"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:layout_marginLeft="5dp"
              android:textSize="15sp"
              android:textColor="#1e356a"
              android:text="9.00P.M - 7.00AM"/&gt;
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:gravity="right"
              android:textSize="12sp"
  
              android:layout_marginRight="30dp"
              android:text="38 seats"
              android:id="@+id/seatcount" /&gt;
  
  
  
  
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="2"
          android:layout_marginTop="5dp"
          android:orientation="horizontal"&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:textSize="12sp"
              android:layout_marginLeft="5dp"
              android:text="2+1 semi sleeeper"
              android:id="@+id/bustype" /&gt;
          &lt;TextView
              android:id="@+id/cancellationpolicy"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:gravity="right"
              android:textSize="12sp"
              android:textColor="@color/holo_blue_light"
              android:layout_marginRight="30dp"
              android:text="Cancellation policy"
             /&gt;
  
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:visibility="gone"
              android:id="@+id/routeid"/&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:visibility="gone"
              android:id="@+id/dropdate"/&gt;
  
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  
          &lt;/android.support.v7.widget.CardView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>java:</p>
  
  <pre><code>@Override
          public void onBindViewHolder(final BusrouteAdapter.ViewHolder viewHolder, final int position) {
  if ((bus_routes.get(position).getAvailableSeats() == 0)) {
                  viewHolder.businfo.setVisibility(View.GONE);
  
  
              } else {
                  viewHolder.businfo.setVisibility(View.VISIBLE);
  
              }
  }
  </code></pre>