개발모음집

ButtonBarSheet listview scroll issue 본문

Android

ButtonBarSheet listview scroll issue

void 2017. 8. 8. 04:10

ButtonBarShee에서 listview를 구현하면 아래에서 위로 스크롤이 되지 않는 이슈가 있다.

블로그를 알게 되었고 참고하여 구현했더니 되긴 한다.


다만 부드럽게 스크롤링이 되진않는다. 차차 해결해야겠지 ㅎㅎ



replylv.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (canScrollVertically(replylv)){
replylv.requestDisallowInterceptTouchEvent(true);
}
return ReadActivity.super.onTouchEvent(motionEvent);
}
});
public boolean canScrollVertically(AbsListView view) {
boolean canScroll = false;

if(view != null && view.getChildCount() > 0) {

boolean isOnTop = view.getFirstVisiblePosition() != 0 || view.getChildAt(0).getTop() != 0;
boolean isAllItemsVisible = isOnTop && view.getLastVisiblePosition() == view.getChildCount();

if(isOnTop || isAllItemsVisible)
canScroll = true;
}


return canScroll;
}