i describe them like that

private void initRecyclerViewListGet() { recyclerViewGet = (RecyclerView) findViewById(R.id.robobet_list_get_cv); StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL); recyclerViewGet.setLayoutManager(layoutManager); recyclerViewGet.setHasFixedSize(true); RobobetListGetAdapter adapter = new RobobetListGetAdapter(initRvListGet()); recyclerViewGet.setAdapter(adapter); } 

The second is also only in the manager I change VERTICAL. They are in my different LinearLayout. Problem in describing layoutManager?

 <?xml version="1.0" encoding="utf-8"?> 

 <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent"> <include layout="@layout/toolbar" /> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="50dp"> <LinearLayout android:id="@+id/rv_list" android:layout_width="match_parent" android:layout_height="60dp" android:orientation="horizontal" android:background="#005c89"> <ImageButton android:id="@+id/robobet_rv_l" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/arrow_robo_l" android:layout_weight="0.05" android:background="#005c89" /> <android.support.v7.widget.RecyclerView android:id="@+id/robobet_list_rv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center" android:layout_weight="0.9"> </android.support.v7.widget.RecyclerView> <ImageButton android:id="@+id/robobet_rv_r" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/arrow_robo_r" android:background="#005c89" android:layout_weight="0.05" /> </LinearLayout> <LinearLayout android:id="@+id/robobet_rv_get" android:layout_width="match_parent" android:layout_height="50dp" android:orientation="vertical" android:layout_below="@id/rv_list" android:layout_marginTop="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center" android:background="#c7d6e9" android:layout_marginStart="8dp" android:layout_marginEnd="8dp"> <TextView android:id="@+id/robobet_txt_match" android:layout_width="170dp" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="bold" android:textColor="#000" android:text="@string/robobet_txt_match"/> <TextView android:id="@+id/robobet_txt_forecatch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="bold" android:textColor="#000" android:textSize="12sp" android:text="@string/robobet_txt_forecatch" android:layout_weight="0.15"/> <TextView android:id="@+id/robobet_txt_kf" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="bold" android:textColor="#000" android:textSize="12sp" android:text="@string/robobet_txt_kf" android:layout_weight="0.12"/> <TextView android:id="@+id/robobet_txt_rate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="bold" android:textColor="#000" android:textSize="12sp" android:text="@string/robobet_txt_rate" android:layout_weight="0.15"/> <TextView android:id="@+id/robobet_txt_score" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textSize="12sp" android:textColor="#000" android:text="@string/robobet_txt_score" android:layout_weight="0.08"/> </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/robobet_list_get_cv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp"/> </LinearLayout> </RelativeLayout> <android.support.design.widget.NavigationView android:id="@+id/navigation_robobet" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:menu="@menu/drawer_menu" app:headerLayout="@layout/nav_header" /> 

But the XML itself in which they are located

Also made a screen, on the left, as it should be, on the right with the missing list

enter image description here

  • Should they be displayed simultaneously or one instead of the other depending on the conditions? - ZigZag
  • 2
    Actually the problem in the question is not described. Do you have something falling or not showing up or not displaying as it should? - Yuriy SPb
  • maybe then it is better to use expandable list or expandable recycler? - ZigZag
  • show xml markup - Vladyslav Matviienko
  • @ YuriySPb has a list of sports (horizontal), but there is a list that goes out of the chosen sport (vertical) and is slightly lower - Taras Zhupnik

1 answer 1

You simply did not give your RecyclerView a place.

 <LinearLayout android:id="@+id/robobet_rv_get" android:layout_width="match_parent" android:layout_height="50dp" android:orientation="vertical" android:layout_below="@id/rv_list" android:layout_marginTop="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center" android:background="#c7d6e9" android:layout_marginStart="8dp" android:layout_marginEnd="8dp"> <!-- Тут у вас заголовки и они заняли всю высоту контейнера.--> </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/robobet_list_get_cv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp"/> </LinearLayout> 

You fit the headlines only, because their container height is match_parent

And the height of the parent container is 50dp and there is no height left for RecyclerView.

For both LinearLayout, you need to specify the height wrap_content in the markup fragment given in the answer wrap_content

  • as always, thanks! - Taras Zhupnik
  • @TarasPupnik, please) By the way, your reputation now allows you not only to accept answers, but also to vote for them) - YurySPb