title: Recycler view not placing view properly
body: <p>I am using a <code>Horizontal Recycler View</code> inside a <code>Vertical Recycler View</code>. The code is working.The problem is that the <code>Row Item</code> of the <code>Horizontal Recycler View</code> is proper.It is not placing the views in correct position</p>
  
  <p>View from the preview in Android Studio
  <a href="https://i.stack.imgur.com/hq98P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hq98P.png" alt="enter image description here"></a> </p>
  
  <p>Actual View from mobile
  <a href="https://i.stack.imgur.com/CP6iN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CP6iN.png" alt="enter image description here"></a></p>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginLeft="10dp"
      android:layout_marginRight="10dp"
      android:background="#000"&gt;
  
      &lt;ImageView
          android:id="@+id/imageView12"
          android:layout_width="match_parent"
          android:layout_height="250dp"
          android:scaleType="fitXY"
          android:src="@drawable/im_bg" /&gt;
  
  
      &lt;TextView
  
          android:id="@+id/tv_featured"
          style="@style/text_style"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignParentTop="true"
          android:layout_marginLeft="10dp"
          android:layout_marginTop="20dp"
          android:background="@drawable/gradient_button"
          android:paddingBottom="10dp"
          android:paddingLeft="30dp"
          android:paddingRight="30dp"
          android:paddingTop="10dp"
          android:text="Featured" /&gt;
  
      &lt;ImageView
          android:id="@+id/iv_share"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/tv_featured"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:padding="10dp"
          android:src="@drawable/ic_explore_share" /&gt;
  
      &lt;ImageView
          android:id="@+id/iv_bookmark"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:padding="10dp"
          android:src="@drawable/ic_explore_bookmark" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_rating"
          style="@style/text_style"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/tv_venue_name"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:layout_marginRight="40dp"
          android:background="@drawable/gradient_button"
          android:padding="05dp"
          android:text="3.5"
          android:textSize="@dimen/title" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_venue"
          style="@style/text_style"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/tv_venue_name"
          android:layout_alignLeft="@+id/tv_venue_name"
          android:layout_alignStart="@+id/tv_venue_name"
          android:layout_marginBottom="05dp"
          android:text="Venue" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_venue_name"
          style="@style/text_style"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/tv_location"
          android:layout_alignLeft="@+id/tv_location"
          android:layout_alignStart="@+id/tv_location"
          android:layout_marginBottom="05dp"
          android:text="JW MARRIOT"
          android:textSize="@dimen/title" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_location"
          style="@style/text_style"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/imageView12"
          android:layout_alignLeft="@+id/tv_featured"
          android:layout_alignStart="@+id/tv_featured"
          android:layout_marginBottom="20dp"
          android:text="Mumbai, Maharashtra" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_rate"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/tv_location"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_marginRight="20dp"
          android:background="@drawable/explore_rounded_amount"
          android:paddingBottom="05dp"
          android:paddingLeft="10dp"
          android:paddingRight="10dp"
          android:paddingTop="05dp"
          android:text="50000"
          android:textSize="@dimen/small" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Vertical Adapter</p>
  
  <pre><code>   private Context context;
  
      private static final int HORIZONTAL_LIST = 0;
      private static final int HEADER = 1;
      private static final int CATEGORIES = 2;
  
      public ExploreVerticalAdapter(Context context) {
          this.context = context;
      }
  
      @Override
      public int getItemViewType(int position) {
  
          if (position == 0) {
  
              return HORIZONTAL_LIST;
  
          } else if (position == 1) {
  
              return HEADER;
  
          } else {
  
              return CATEGORIES;
          }
  
  
      }
  
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          if (viewType == HORIZONTAL_LIST) {
  
              View view = LayoutInflater.from(context).inflate(R.layout.custom_explore_vertical_item, parent, false);
              HorizontalHolder viewHolder = new HorizontalHolder(view);
              return viewHolder;
  
          } else if (viewType == HEADER) {
  
              View view = LayoutInflater.from(context).inflate(R.layout.custom_explore_header, parent, false);
              HeaderHolder viewHolder = new HeaderHolder(view);
              return viewHolder;
          } else {
  
  
              View view = LayoutInflater.from(context).inflate(R.layout.custom_vertical_categories, parent, false);
              CategoriesHolder viewHolder = new CategoriesHolder(view);
              return viewHolder;
          }
  
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
  
  
          switch (holder.getItemViewType()) {
  
              case HORIZONTAL_LIST:
  
                  HorizontalHolder horizontalHolder = (HorizontalHolder) holder;
                  ExploreHorizontalAdapter adapter = new ExploreHorizontalAdapter(context);
  
                  horizontalHolder.rvHorizontalList.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true));
                  horizontalHolder.rvHorizontalList.setNestedScrollingEnabled(false);
                  horizontalHolder.rvHorizontalList.setAdapter(adapter);
                  adapter.notifyDataSetChanged();
  
                  break;
  
              case HEADER:
  
                  break;
  
              case CATEGORIES:
  
                  break;
          }
  
      }
  
      @Override
      public int getItemCount() {
          return 9;
      }
  
      class HorizontalHolder extends RecyclerView.ViewHolder {
  
          private RecyclerView rvHorizontalList;
  
          public HorizontalHolder(View itemView) {
              super(itemView);
  
              rvHorizontalList = (RecyclerView) itemView.findViewById(R.id.rv_explore_hor_list);
              rvHorizontalList.setNestedScrollingEnabled(false);
              rvHorizontalList.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
              rvHorizontalList.setAdapter(null);
          }
      }
  
      class HeaderHolder extends RecyclerView.ViewHolder {
  
          public HeaderHolder(View itemView) {
              super(itemView);
          }
      }
  
      class CategoriesHolder extends RecyclerView.ViewHolder {
  
          private TextView tvTitle;
          private ImageView ivImage;
  
          public CategoriesHolder(View itemView) {
              super(itemView);
  
              tvTitle = (TextView) itemView.findViewById(R.id.tv_cat_tittle);
              ivImage = (ImageView) itemView.findViewById(R.id.iv_cat_image);
          }
      }
  </code></pre>
  
  <p>Horizontal Adapter</p>
  
  <pre><code> private Context context;
  
      public ExploreHorizontalAdapter(Context context) {
          this.context = context;
      }
  
      @Override
      public RecommendedHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(context).inflate(R.layout.custom_explore_hor_item, parent, false);
          RecommendedHolder holder = new RecommendedHolder(view);
          return holder;
      }
  
      @Override
      public void onBindViewHolder(RecommendedHolder holder, int position) {
  
  
  
      }
  
      @Override
      public int getItemCount() {
          return 5;
      }
  
      class RecommendedHolder extends RecyclerView.ViewHolder {
  
          private TextView tvFeatured;
          private TextView tvVenue;
          private TextView tvVenueName;
          private TextView tvLocation;
          private TextView tvRating;
          private TextView tvAmount;
          private ImageView ivShare;
          private ImageView ivBookmark;
  
  
          public RecommendedHolder(View itemView) {
              super(itemView);
  
              tvFeatured = (TextView) itemView.findViewById(R.id.tv_featured);
              tvVenue = (TextView) itemView.findViewById(R.id.tv_venue);
              tvVenueName = (TextView) itemView.findViewById(R.id.tv_venue_name);
              tvLocation = (TextView) itemView.findViewById(R.id.tv_location);
              tvRating = (TextView) itemView.findViewById(R.id.tv_rating);
              tvAmount = (TextView) itemView.findViewById(R.id.tv_rate);
  
          }
      }
  </code></pre>