CoordinatorLayout AppBarLayout中嵌套RecyclerView,作为RecyclerView的item时,setCurrentItem(item, false)后,再次setCurrentItem(item)时,动画会滚动多次
Closed this issue · 5 comments
CoordinatorLayout AppBarLayout中嵌套RecyclerView,作为RecyclerView的item时,setCurrentItem(item, false)后,再次setCurrentItem(item)时,动画会滚动多次
能在demo写个例子提交嘛?
<androidx.constraintlayout.widget.ConstraintLayout 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"
xmlns:toolsNs="http://schemas.android.com/tools"
android:background="@color/white">
<com.xiaobang.common.view.recyclerview.smart.PullRefreshLayout
android:id="@+id/srl_refreshLayout"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="@dimen/dimen_0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:srlEnableLoadMore="false"
app:srlEnableRefresh="true"
app:srlEnableOverScrollBounce="false"
app:srlEnableNestedScrolling="false"
app:srlEnableFooterTranslationContent="false"
>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
android:descendantFocusability="afterDescendants"
>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:orientation="vertical"
android:theme="@style/XbAppBarLayout"
app:elevation="@dimen/dimen_0dp"
app:layout_behavior="com.xiaobang.common.view.behavior.AppBarLayoutBehavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/top_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/vw_recyclerview"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:cacheColorHint="@color/transparent"
android:fadingEdge="none"
android:listSelector="@color/transparent"
android:overScrollMode="never"
android:nestedScrollingEnabled="false"
android:descendantFocusability="blocksDescendants"
android:scrollbars="none"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_tab"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_60dp"
>
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/tab_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<View
android:id="@+id/view_line"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="@dimen/dimen_1px"
android:visibility="gone"
android:background="@color/xb_divider_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.xiaobang.common.view.VerticalCompatHoriViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</com.xiaobang.common.view.recyclerview.smart.PullRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
itemView.banner?.setIndicator(
IndicatorView(itemView.context)
?.setIndicatorColor(
ContextCompat.getColor(
XbBaseApplication.INSTANCE,
R.color.c_cccccc
)
)
?.setIndicatorSelectorColor(
ContextCompat.getColor(
XbBaseApplication.INSTANCE,
R.color.c_222222
)
)
?.setIndicatorRadius(2.0f)
?.setIndicatorRatio(1.0f)
?.setIndicatorSelectedRadius(2.0f)
?.setIndicatorSelectedRatio(2.5f)
?.setIndicatorSpacing(1f)
?.setIndicatorStyle(IndicatorView.IndicatorStyle.INDICATOR_BIG_CIRCLE)
?.setParams(layoutParams)
)
?.setPageMargin(0, dp16)
?.setAutoPlay(true)
?.adapter = bannerV2Adapter
补充:手动拖动也会有问题
已解决