title: Android - CardView give strange behaviour
body: <p>here is my situation I have list view (RecyclerView) </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/coordiatelayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/dark_gray"&gt;
  
      &lt;TextView
          android:id="@+id/reload"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:text="@string/reload"
          android:visibility="gone" /&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressbar"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:visibility="gone"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          /&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/questionlist"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_gravity="center" /&gt;
  
      &lt;android.support.design.widget.FloatingActionButton
          android:id="@+id/FloatingView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginBottom="15dp"
          android:clickable="true"
          app:layout_anchor="@id/questionlist"
          app:layout_anchorGravity="right|bottom|end"
          android:src="@drawable/ic_add_circle_outline_24dp"
           /&gt;
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>I maintain this recycle view with adapter </p>
  
  <pre><code>public class ListViewAdapter extends RecyclerView.Adapter&lt;ListViewAdapter.ViewHolder&gt; {
  
      private Context _Context;
  
      private List&lt;QuestionItem&gt; Questions = new ArrayList&lt;&gt;();
      private API api;
      private int num;
      private int lastPosition = -1;
      public static final String BASE_POST_URl = "http://la3nyk.com/upload/";
  
      public ListViewAdapter(Context context, List&lt;QuestionItem&gt; Questions) {
          this._Context = context;
          this.Questions = Questions;
          api = new API(context);
      }
  
      public ListViewAdapter(Context context, List&lt;QuestionItem&gt; Questions,
              int num) {
          this._Context = context;
          this.Questions = Questions;
          this.num = num;
          api = new API(context);
      }
  
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          LayoutInflater inflater = LayoutInflater.from(_Context);
          View itemView = inflater.inflate(R.layout.questions, null);
          return new ViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          Typeface tf = Typeface.createFromAsset(_Context.getAssets(),
                  "fonts/GE_SS_Two_Bold.otf");
          Typeface tfreg = Typeface.createFromAsset(_Context.getAssets(),
                  "fonts/GE_SS_Two_Light.otf");
  
          ImageLoader _ImageLoader = MySingleton.getInstance(_Context).getmImageLoader();
  
          holder.imageView.setImageUrl( BASE_POST_URl + Questions.get(position).getQue_image_url(), _ImageLoader);
          holder.username.setTypeface(tf);
          holder.username.setText(Questions.get(position).user.username);
          holder.desc.setText(Questions.get(position).Que_Content);
          holder.desc.setTypeface(tfreg);
          holder.Date.setTypeface(tfreg);
          holder.Category.setText(Questions.get(position).category);
          holder.AnswersCount.setTypeface(tfreg);
          holder.Date.setText(Questions.get(position).Que_Date);
          holder.AnswersCount.setText(Questions.get(position).answers.size() + " " + _Context.getResources().getString(R.string.answers));
          holder.AnswersCount.setVisibility(View.VISIBLE);
  
  
  
  //      if (num == 1)
  //          Questions.get(pos).user.userimageURL = api
  //                  .getSetting(AppConstants.TAG_user_photo);
  //
  //
  //
  //      if (Questions.get(pos).Que_image_url != null) {
  //          if (!Questions.get(pos).Que_image_url.contentEquals("")) {
  //              post_img.setVisibility(View.VISIBLE);
  //              //loader.DisplayImage(Questions.get(pos).Que_image_url, post_img,
  //              //      post_img_pro, -1);
  //          }
  //      }
  //
  //
  
           //if (num == 1) {
           //arrow.setImageResource(R.drawable.p_data_7);}
           //arrow.setVisibility(View.VISIBLE);
  
  //      Animation animation = null;
  //       animation = AnimationUtils.loadAnimation(_Context,
  //               R.anim.up_from_bottom);
  //       animation.setDuration(500);
  //          view.setAnimation(animation);
  //            animation = null;
  //
  //      Animation animation = AnimationUtils.loadAnimation(_Context,
  //              (pos &gt; lastPosition) ? R.anim.up_from_bottom
  //                      : R.anim.down_from_top);
  //      view.startAnimation(animation);
  //      lastPosition = pos;
  
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public int getItemCount() {
          return Questions.size();
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder {
  
          protected NetworkImageView imageView , post_img;
          protected TextView desc , Category ,username ,Date ,AnswersCount;
          protected ProgressBar userimageprog ,post_img_pro;
          protected ImageView arrow;
  
          public ViewHolder(View itemView) {
              super(itemView);
               imageView = (NetworkImageView) itemView.findViewById(R.id.ques_user_img);
               desc = (TextView) itemView.findViewById(R.id.ques_content);
               Category = (TextView) itemView.findViewById(R.id.category);
               post_img = (NetworkImageView) itemView.findViewById(R.id.post_img);
               userimageprog = (ProgressBar) itemView.findViewById(R.id.userimgae_prog);
               post_img_pro = (ProgressBar) itemView.findViewById(R.id.post_img_pro);
               username = (TextView) itemView.findViewById(R.id.username_ques);
               Date = (TextView) itemView.findViewById(R.id.date);
               AnswersCount = (TextView) itemView.findViewById(R.id.answers_con);
              arrow = (ImageView) itemView.findViewById(R.id.imageView1);
  
          }
      }
  }
  </code></pre>
  
  <p>CardView xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:cardview="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      cardview:cardBackgroundColor="@android:color/white"
      android:layout_gravity="center_horizontal"
      android:layout_marginLeft="8dp"
      android:layout_marginRight="8dp"
      cardview:cardCornerRadius="5dp"
      cardview:cardElevation="2dp"
      &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_margin="10dp"
          android:orientation="vertical"
          &gt;
  
          &lt;TextView
              android:id="@+id/category"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              android:background="@color/blue"
              android:padding="10dp"
              android:text="TextView"
              android:textColor="@android:color/white" /&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              android:orientation="horizontal" &gt;
  
              &lt;FrameLayout
                  android:id="@+id/frameLayout1"
                  android:layout_width="60dp"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginBottom="10dp"
                  android:layout_marginLeft="4dp"
                  android:layout_marginRight="4dp"
                  android:layout_marginTop="10dp" &gt;
  
                  &lt;com.android.volley.toolbox.NetworkImageView
                      android:id="@+id/ques_user_img"
                      android:layout_width="60dp"
                      android:layout_height="60dp"
                      android:src="@drawable/profile" /&gt;
  
                  &lt;ProgressBar
                      android:id="@+id/userimgae_prog"
                      style="?android:attr/progressBarStyleSmall"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:visibility="gone" /&gt;
  
  
              &lt;/FrameLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:orientation="vertical" &gt;
  
                  &lt;TextView
                      android:id="@+id/username_ques"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:text="Asmaa Samir"
                      android:textColor="@android:color/black"
                      android:textStyle="bold" /&gt;
  
                  &lt;TextView
                      android:id="@+id/date"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:layout_marginTop="3dp"
                      android:textColor="@android:color/black"
                      android:text="2 days ago" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_weight="1"
              android:orientation="vertical" &gt;
  
              &lt;TextView
                  android:id="@+id/ques_content"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_margin="4dp"
                  android:text="ماهى اسباب ضعف الرؤيه أمام الحاسوب؟"
                  android:textColor="@android:color/black"
                  android:textStyle="bold" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;ImageView
              android:id="@+id/imageView1"
              android:layout_width="40dp"
              android:layout_height="40dp"
              android:layout_gravity="center"
              android:src="@drawable/qustion_8"
              android:visibility="gone" /&gt;
  
          &lt;com.android.volley.toolbox.NetworkImageView
              android:id="@+id/post_img"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:src="@drawable/ic_launcher"
              android:visibility="gone" /&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="0dp"
              android:layout_gravity="right"
              android:layout_weight="1"
              android:orientation="horizontal" &gt;
  
              &lt;TextView
                  android:id="@+id/answers_con"
                  android:visibility="gone"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_margin="10dp"
                  android:layout_weight="1"
                  android:text="32 إجابه" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
  
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p>here is my screenshot , 
  <strong>what is my question ?</strong></p>
  
  <p>1- I got warp content cardview as appear in image.</p>
  
  <p>2- my floating button appear down when view start load.</p>
  
  <p><a href="https://i.stack.imgur.com/InIz3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/InIz3.png" alt="enter image description here"></a></p>