본문 바로가기

AppBarLayout

[Android] AppbarLayout 과 RecyclerView ChildView AppbarLayout과 RecycerView만 연동을 할 때는 스크롤이 문제 없이 잘 된다. 하지만, 혹시 RecyclerView안에 RecyclerView를 넣을 경우 RecyclerView 안에 있는 RecyclerView를 스크롤 하면 AppbarLayout이 움직이지 않는 현상이 발생 하기도 합니다. 이럴 경우, Child RecyclerView의 Scroll를 막아주면 됩니다. 방법은 두가지가 있습니다. 1. setNestedScrollingEnabled 함수에 false 값을 넘깁니다.mRecycleView.setNestedScrollingEnabled(false); 2. LayoutManager를 커스터마이징 합니다. public class CustomLinearLayoutManager e.. 더보기
[Android] 강제로 AppbarLayout 열기 혹시 특정 시점에 AppbarLayout을 강제로 열고자할 경우 아래글을 읽어보세요. Using support libs v23 you can call appBarLayout.setExpanded(true/false) http://stackoverflow.com/a/32137264/3534559 setExpaned(true)를 주면 자동으로 AppbarLayout이 열립니다. 또 다른 오바라이딩 함수로 setExpaned(boolean expaned, boolean animate)로 되어 있습니다.animating을 할지 결정이 가능합니다. 디폴트는 animate가 true로 되어 있습니다.참고하세요. 더보기
[Android] AppBarLayout in SwipeRefreshLayout SwipeRefreshLayout 안에 AppBar가 있는 경우 Loading 이미지가 원하지 않는 시점에서 보여지는 경우가 발생한다. 최상위 스크롤 에서 이벤트 동작이 일어나지 않고, 어느 위치에서든지 스크롤을 내리면 LoadingProgressBar가 보이게 되는 것이다. 이럴 경우, AppBarLayout의 addOnOffsetChangedListener를 통하여 해결이 가능하다. AppBarContainer.addOnOffsetChangedListener(this); 위와 같이 리스너를 등록 한후, 아래와 같이 offset이 0일 경우에는 swipe 동작이 이뤄지도록 설정 하면 된다.@Override public void onOffsetChanged(AppBarLayout appBarLayout,.. 더보기