【发布时间】:2021-01-01 22:52:00
【问题描述】:
我有一个片段,其中包含一个嵌套滚动视图。在这个嵌套滚动视图中有一个视图分页器和回收视图。当我滚动视图时,只回收视图滚动,视图分页器不滚动。我想滚动回收视图和视图分页器。我尝试了很多方法,但没有成功。请帮助我.....
<?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:custom="http://schemas.android.com/tools"
android:id="@+id/timeline_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:orientation="vertical"
android:tag="timeline_fragment">
<androidx.core.widget.NestedScrollView
android:id="@+id/nst_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/crv_profile_visit"
android:layout_weight="1"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_view_pager"
android:layout_width="match_parent"
android:layout_height="@dimen/_140sdp"
android:visibility="gone"">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<!-- <com.customView.CustomViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:nestedScrollingEnabled="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
-->
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
<com.ViewPagerWithIndicator.TimelineFragmentViewPageWithIndicator
android:id="@+id/timelineViewPagerWithIndicator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
app:arrow.enable="true"
app:arrow.height_="50dip"
app:arrow.width_="50dip"
app:left_arrow.drawable="@drawable/arrow_left_promotion"
app:right_arrow.drawable="@drawable/arrow_right_promotion"
app:round.color.default="@android:color/white"
app:round.color.selected="@android:color/holo_blue_light"
app:round.drawable="@drawable/background_rounded_view_pager_indicater"
app:round.enable="true"
app:round.size="15dip">
</com.ViewPagerWithIndicator.TimelineFragmentViewPageWithIndicator>
</RelativeLayout>
<ImageView
android:id="@+id/img_no_feed"
android:layout_width="@dimen/_100sdp"
android:layout_height="@dimen/_100sdp"
android:layout_centerInParent="true"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycleview_user_time_line"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/_3sdp"
android:nestedScrollingEnabled="true" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/ll_create_post"
android:layout_width="@dimen/_170sdp"
android:layout_height="@dimen/_200sdp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_poll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_margin="8dp"
android:gravity="center"
android:text="@string/txt_timeline_fragment_poll"
android:textColor="@android:color/holo_red_dark"
android:visibility="invisible"
app:backgroundTint="@android:color/holo_orange_light"
app:rippleColor="@android:color/holo_red_light" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_margin="8dp"
android:gravity="center"
android:text="@string/txt_timeline_fragment_post"
android:textColor="@android:color/white"
android:visibility="invisible"
app:backgroundTint="@android:color/holo_orange_light"
app:rippleColor="@android:color/holo_red_light" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_margin="8dp"
android:textColor="@android:color/holo_red_dark"
app:backgroundTint="@android:color/holo_orange_light"
app:icon="@drawable/ic_float_button"
app:iconTint="@android:color/white"
app:rippleColor="@android:color/holo_red_light" />
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
crv_profile_visit在哪里 -
不,回收视图没有问题。我使用视图寻呼机以三个点自动显示多个图像滑动。我的问题是只有回收视图滚动....查看寻呼机无法滚动。我想要两个滚动。如果我的设计有任何错误,请提出建议。我不知道谁给了我反对票,我是新来的。如果可能,请删除反对票。
标签: android android-layout android-viewpager scrollview android-nestedscrollview