gpt4 book ai didi

java - NestedScrollView 内的 ViewPager 内的 RecyclerView - 效果不佳

转载 作者:行者123 更新时间:2023-12-01 18:01:07 25 4
gpt4 key购买 nike

问题是NestedScrollView RecyclerView 时不滚动有数据。

<androidx.core.widget.NestedScrollView ...
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

...
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp_perfil"
android:layout_width="match_parent"
android:layout_height="600dp"
android:background="#8E5252">
</androidx.viewpager.widget.ViewPager>

</androidx.core.widget.NestedScrollView>

就像 NestedScrollView是正常布局,无法设置ViewPagerwrap_content因为它只能像match_parent一样工作.

最佳答案

尝试像下面的代码 fragment :

<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<androidx.core.widget.NestedScrollView
android:id="@+id/sv_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/ll_product_detail_bottom"
android:layout_alignParentTop="true"
android:overScrollMode="never">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_5">

<androidx.viewpager.widget.ViewPager
android:id="@+id/pd_pager"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />

<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/pd_indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="bottom"
android:padding="@dimen/padding_10"
app:centered="true"
app:fillColor="@color/colorPrimary"
app:pageColor="@android:color/darker_gray"
app:snap="false" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

希望这对你有帮助

关于java - NestedScrollView 内的 ViewPager 内的 RecyclerView - 效果不佳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60625800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com