NestedScrollView не прокручивает? Есть идеи, как это исправить - PullRequest
0 голосов
/ 21 мая 2019

Я работаю над проектом электронной коммерции с разметкой сведений о продукте. Nestedscrollview не прокручивается. Отображаемый контент просто исправлен.Перепробовал почти все, но он не прокручивается

Я ожидал, что он прокрутится, но это не произошло вовсе.Это просто исправлено.Все содержимое ниже, и я не могу прокрутить

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ProductDetails">
    <include
        android:id="@+id/appbarlayout"
        layout="@layout/appbar"/>
    <android.support.v4.widget.NestedScrollView
        android:layout_below="@+id/appbarlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >
            <ImageView
                android:id="@+id/productimg"
                android:layout_width="match_parent"
                android:background="@color/colorPure"
                android:layout_height="220dp" />%
            <LinearLayout
                android:layout_marginTop="10dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                >
                <TextView
                    android:id="@+id/pname"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Product Name"
                    android:textColor="@color/colorFade"
                    />
                <TextView
                    android:id="@+id/pprice"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Price"
                    android:textColor="@color/colorGreenary"
                    />

                <TextView
                    android:id="@+id/pavailability"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Availablity"
                    android:textColor="@color/colorFade"
                    />
                <TextView
                    android:id="@+id/prackno"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Rack No"
                    android:textColor="@color/colorFade"
                    />
                <TextView
                    android:id="@+id/pfloorno"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Floor No"
                    android:textColor="@color/colorFade"
                    />
                <View
                    android:layout_margin="10dp"
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:background="@color/colorLightFade"
                    />
                <TextView
                    android:id="@+id/pdescription"
                    android:layout_marginLeft="10dp"
                    android:layout_marginBottom="6dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Description"
                    android:textColor="@color/colorFade"
                    />
            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

    <LinearLayout
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="1"
        >
        <Button
            android:id="@+id/addtowishlist"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:text="ADD TO WISHLIST"
            android:background="@color/colorPure"
            />
        <Button
            android:id="@+id/addtocart"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:background="@color/colorAccent"
            android:textColor="@color/colorPure"
            android:text="ADD TO CART"
            />
    </LinearLayout>
     </RelativeLayout>

Ответы [ 2 ]

0 голосов
/ 22 мая 2019

Сработало, я изменил родительский атрибут Relative Layout

android:layout_height="match_parent"
до
android:layout_height="wrap_content"
0 голосов
/ 21 мая 2019

пожалуйста, измените этот атрибут в вашем NestedScrollView:

        android:layout_height="wrap_content"

до

        android:layout_height="match_parent"

или на фиксированную высоту, если вам нужен виджет под ним

Поэтому попробуйте изменить этот атрибут в родительском макете

android:layout_height="wrap_content"
...