更改子布局使AppBarLayout $ ScrollingViewBehavior错误

问题描述 投票:0回答:1

这是我的布局:

CoordinatorLayout AppBarLayout ... AnimatableTabs SwipeRefreshLayout

现在没有问题。

现在,Down Gesture的行为是:

1.首先扩展AppBarLayout。

2.show pullDownRefresh SwipeRefreshLayout第二圈。

enter image description here

但是,在我为AnimatableTabs添加动画之后。

```kotlin appbar.addOnOffsetChangedListener {appBarLayout,verticalOffset - > ...

// FIXME: 2018/3/5
//This code make behavior incorrectly.
ll_tabs.apply {
    ll_tabs_left.apply widthProvider@ {
        layoutParams = (layoutParams as LinearLayout.LayoutParams).apply {
            leftMargin = ([email protected] * collapsedHotPercent).toInt()
        }
    }
    ll_tabs_right.apply widthProvider@ {
        layoutParams = (layoutParams as LinearLayout.LayoutParams).apply {
            rightMargin = ([email protected] * collapsedHotPercent).toInt()
        }
    }

    //It seems requestLayout() make behavior incorrectly.
}

}

发生了一个问题:

羽绒手势的行为是:

展开AppBarLayout并同时显示pullDownRefresh Circle。

enter image description here

这是代码:

code on GitHub

无论如何要解决它?似乎requestLayout()使行为不正确。

android android-coordinatorlayout android-appbarlayout
1个回答
0
投票

解决了。通过改变xml结构:

CoordinatorLayout AppBarLayout ... Tabs AnimatableElements SwipeRefreshLayout

现在我可以使用自定义行为了。

© www.soinside.com 2019 - 2024. All rights reserved.