goweii / AnyLayer

Android稳定高效的浮层创建管理框架
https://github.com/goweii/AnyLayer
Apache License 2.0
990 stars 114 forks source link

界面存在RecyclerView造成RecyclerView滑动 #7

Closed SilenceJR closed 5 years ago

SilenceJR commented 5 years ago

你好,在存在RecyclerView加载图片的界面调用, 并且有点击存在时,

onClick(AnyLayer.OnLayerClickListener { p0, p1 ->
                        p0.dismiss()
                        when (p1.id) {
                            R.id.tv_edit -> {
                                startActivity<NewTaskActivity>("order" to mData)
                            }
                            R.id.tv_delete -> {
                                mData?.apply {
                                    mPresenter.operatorRewardOrder(id, RewardOrderBean.OPERATOR_TYPE_REVOKE)
                                }
                            }
                            else -> {
                            }
                        }
                    }, R.id.tv_edit, R.id.tv_delete, R.id.tv_cancel)

会造成RecyclerView向下滑动一段距离, 请问这个能解决么?
点击前 点击后

SilenceJR commented 5 years ago

dialog弹出和点击取消按钮后界面直接进行了跳动,

AnyLayer.with(this)
                    .contentView(R.layout.dialog_grad_order_manage)
                    .gravity(Gravity.BOTTOM)
                    .backgroundColorRes(R.color.tip_background)
                    .contentAnim(object : AnyLayer.IAnim {
                        override fun inAnim(p0: View?): Long {
                            AnimHelper.startBottomAlphaInAnim(p0, ANIM_DURATION)
                            return ANIM_DURATION
                        }

                        override fun outAnim(p0: View?): Long {
                            AnimHelper.startBottomAlphaOutAnim(p0, ANIM_DURATION)
                            return ANIM_DURATION
                        }
                    })
                    .onClick(AnyLayer.OnLayerClickListener { p0, p1 ->
                        p0.dismiss()
                        when (p1.id) {
                            R.id.tv_edit -> {
                                startActivity<NewTaskActivity>("order" to mData)
                            }
                            R.id.tv_delete -> {
                                mData?.apply {
                                    mPresenter.operatorRewardOrder(id, RewardOrderBean.OPERATOR_TYPE_REVOKE)
                                }
                            }
                            else -> {
                            }
                        }
                    }, R.id.tv_edit, R.id.tv_delete, R.id.tv_cancel)
                    .show()
goweii commented 5 years ago

我猜测因该是因为焦点改变引起的,弹窗消失后,recyclerview强制获取到焦点,自动滚动到顶部。你可以给recyclerview的父布局设置强制获取焦点。

SilenceJR commented 5 years ago

我猜测因该是因为焦点改变引起的,弹窗消失后,recyclerview强制获取到焦点,自动滚动到顶部。你可以给recyclerview的父布局设置强制获取焦点。

3Q, 这个问题现在已经解决