我已经尝试过了,我不知道为什么我的 ScrollView 不起作用。 我已经将 ScrollView 的子布局更改为wrap_content高度,但仍然无法正常工作。正如我所期望的,我的按钮位于底部,但内容应该可以滚动,并且我在 1 个卡片 View 中切换了内容,谢谢
<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="wrap_content"
android:background="@color/grey"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<cardview>
<cardview>
<cardview>
<cardview> here i have toggle content
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/len_16dp"
android:layout_marginTop="@dimen/len_12dp"
android:layout_marginRight="@dimen/len_16dp"
android:foreground="@drawable/inverted_corners"
android:orientation="vertical"
tools:ignore="MissingConstraints">
<com.prismalink.mbddlibrary.util.UnscrollableList
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:clickable="false"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom|center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/btnBayar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
</RelativeLayout>
最佳答案
这段代码运行良好,抱歉我的小错误。只需将其添加到scrollView子项中并 我意识到内容与父级高度相同
android:paddingBottom="@dimen/len_64dp"
关于java - ScrollView 无法滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56268394/