Skip to content

Commit 7cba987

Browse files
author
teach
committed
改bug
1 parent e7b1d6f commit 7cba987

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

consecutivescroller/src/main/java/com/donkingliang/consecutivescroller/ConsecutiveScrollerLayout.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ public class ConsecutiveScrollerLayout extends ViewGroup implements ScrollingVie
147147
private boolean isPermanent;
148148

149149
/**
150-
* 禁用子view的水平滑动,如果ConsecutiveScrollerLayout下没有需要水平滑动的子view,应该把它设置为true
151-
* 为true时,将不会分发滑动事件给子view,而是有ConsecutiveScrollerLayout处理,可以优化ConsecutiveScrollerLayout的滑动
150+
* 禁用子view的水平滑动,如果ConsecutiveScrollerLayout下没有水平滑动的下级view,应该把它设置为true
151+
* 为true时,将不会分发滑动事件给子view,而是由ConsecutiveScrollerLayout处理,可以优化ConsecutiveScrollerLayout的滑动
152152
*/
153153
private boolean disableChildHorizontalScroll;
154154

@@ -277,6 +277,9 @@ public ConsecutiveScrollerLayout(Context context, AttributeSet attrs, int defSty
277277
mChildHelper = new NestedScrollingChildHelper(this);
278278
setNestedScrollingEnabled(true);
279279
setChildrenDrawingOrderEnabled(true);
280+
281+
setMotionEventSplittingEnabled(false);
282+
280283
}
281284

282285
@Override
@@ -2317,6 +2320,23 @@ public boolean isPermanent() {
23172320
return isPermanent;
23182321
}
23192322

2323+
2324+
public boolean isDisableChildHorizontalScroll() {
2325+
return disableChildHorizontalScroll;
2326+
}
2327+
2328+
/**
2329+
* 禁用子view的水平滑动,如果ConsecutiveScrollerLayout下没有水平滑动的下级view,应该把它设置为true
2330+
* 为true时,将不会分发滑动事件给子view,而是由ConsecutiveScrollerLayout处理,可以优化ConsecutiveScrollerLayout的滑动
2331+
* 注意:如果你的ConsecutiveScrollerLayout下使用了ViewPager、HorizontalScrollView、水平滑动RecyclerView等,
2332+
* 就不要设置disableChildHorizontalScroll为true.因为它会禁止水平滑动
2333+
*
2334+
* @param disableChildHorizontalScroll
2335+
*/
2336+
public void setDisableChildHorizontalScroll(boolean disableChildHorizontalScroll) {
2337+
this.disableChildHorizontalScroll = disableChildHorizontalScroll;
2338+
}
2339+
23202340
/**
23212341
* 设置吸顶view到顶部的偏移量,允许吸顶view在距离顶部offset偏移量的地方吸顶停留。
23222342
*

0 commit comments

Comments
 (0)