我正在一个电子商务项目中,其产品详细信息布局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>
答案 0 :(得分:0)
请在您的NestedScrollView
中更改此属性:
android:layout_height="wrap_content"
到
android:layout_height="match_parent"
或固定高度,如果您需要在其下方放置一些小部件
因此,请尝试在父级布局中更改此属性
android:layout_height="wrap_content"
答案 1 :(得分:0)
工作正常,我更改了父级相对布局属性
android:layout_height="match_parent"
到
android:layout_height="wrap_content"