ребята. Не могу справиться с проблемой. Я прошу совета.
У меня есть BottomSheetBehaviour с RecyclerView внутри (и другими элементами интерфейса). RecyclerView может содержать много контента, то есть он должен прокручиваться, когда весь контент не попадает на экран.
Когда в RecyclerView загружается мало контента (несколько элементов), он все правильно выводит aws. BottomSheetBehaviour работает должным образом ( ссылка на скриншот ).
Однако, если я загружаю много контента, RecyclerView больше не др aws it ( ссылка на скриншот ) .
Я прилагаю код разметки ниже.
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable name="data" type=".controls.ControlSelectCategoriesFragment"/>
</data>
<FrameLayout
style="?AppTheme.BottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:elevation="4dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
tools:context=".controls.ControlSelectDateFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:background="?attr/AppTheme.ColorBottomSheetBackground"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent">
<CODE HEADER id/header>
<RelativeLayout
android:id="@+id/recycler_view1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header"
app:layout_constraintBottom_toTopOf="@+id/accept_button">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:adjustViewBounds="true"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" />
</RelativeLayout>
<CODE BUTTON id/accept_button>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</FrameLayout>
</layout>
Ниже я прилагаю код, который добавляет адаптер к RecyclerView
private void prepareData(){
listCategoriesAdapter = new ListCategoriesAdapterV2(parentContext, SessionManager.getInstance().getDataManager().findCategoriesByType(type), R.layout.view_category_hexagonal_item);
listCategoriesAdapter.setModeSelecting(TypeSelectingModeAdapter.Single);
listCategoriesAdapter.setVisibilityDetails(true);
updateRecyclerView();
}
private void updateRecyclerView() {
if (binder != null) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) binder.recyclerView.getLayoutManager();
gridLayoutManager.setSpanCount(Math.min(4, listCategoriesAdapter.getElementsSize()));
binder.recyclerView.setAdapter(listCategoriesAdapter);
}
}
В результате, если BottomSheetDialog не делает не открывается полный экран (не хватает контента), мой RecyclerView работает нормально (скриншот) . Если контента много, а BottomSheetDialog открывается в полноэкранном режиме, то RecyclerView ничего не рисует (скриншот) .
Пожалуйста, помогите мне решить проблему! Спасибо.