Android : ListView jumping when changing custom dividers height based on overscroll delta

on Tuesday, March 31, 2015


I'm working on the custom ListView. I have a problem when changing the dividers height (Just a View with background color black not listview's default divider). Video: https://www.youtube.com/watch?v=uCCe_LzxFEk


The divider's height is based on overscroll delta. This is the code for changing divider's height. Code works well when dragging from top to bottom but it is very jumpy when dragging from bottom to top.



public void changeDividerHeight(View view, int delta) {
if (Math.abs(delta) > getResources().getDimensionPixelSize(R.dimen.one_dip)) {
ViewGroup.LayoutParams params = view.getLayoutParams();
params.height = Math.abs(delta);
view.requestLayout();
requestLayout();
}
}

0 comments:

Post a Comment