0

Мне нужно, чтобы RecyclerView скроллился(с этим все в порядке), а TextView нет, т.е всегда оставался наверху bottom sheet. Вот xml этого фрагмента:

<android.support.v4.widget.NestedScrollView
        android:id="@+id/bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:fillViewport="true"
        android:background="#898989"
        app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textViewR"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:text="dgd"
                android:gravity="center"
                android:textColor="#fff"


                />
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="8dp"
                android:orientation="vertical"
                android:layout_weight="1"
                android:paddingBottom="15dp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                />

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

Благодарю за помощь!

4
  • 2
    Ну просто вытащите TextView из ScrollView.
    – eugeneek
    9 июн 2017 в 14:20
  • и куда его деть? 9 июн 2017 в 14:36
  • Например сделать корневым вертикальный LinearLayout в котором будет первым идти ваш TextView, а за ним ScrollView.
    – eugeneek
    9 июн 2017 в 14:42
  • все равно не понимаю, у меня есть выдвижная панель(bottom sheet) Nested Scroll View может содержать только один элемент. И деть TextView некуда больше 9 июн 2017 в 14:48

1 ответ 1

0

Раз у вас используется RecyclerView, то дополнительный NestedScrollView тут вообще не нужен. Используйте следующую разметку:

<LinearLayout
    android:id="@+id/bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:fillViewport="true"
    android:background="#898989"
    android:orientation="vertical"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <TextView
        android:id="@+id/textViewR"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:text="dgd"
        android:gravity="center"
        android:textColor="#fff"
        />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="8dp"
        android:orientation="vertical"
        android:layout_weight="1"
        android:paddingBottom="15dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        />

</LinearLayout>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.