1

코디네이터 레이아웃 내에서 툴바 레이아웃이 축소되고 해당 리사이클 뷰가 모두 2 개 (조각 A 및 단편 B)입니다.축소 도구 모음 조각에서 반환 할 때 항상 레이아웃이 확장됩니다.

내 recyclerview에서 위로 스크롤 한 다음 CollapsingToolbarLayout이 축소 된 경우 조각 A에서 A 조각 (백 스택에 A를 밀기)을 엽니 다.

내가 다시 타격으로써 조각 A로 돌아갈 때. 리사이클 러 뷰가 같은 위치에 있더라도 CollapsingToolbarLayout/AppBarLayout은 항상 확장됩니다.

누구나이 경험이 있으십니까?

답변

0

나는 내가 코드를 아래로 쓰기 때문에 같은 문제에 직면했다 : -

private boolean isExpand = true; 
private void setTitleNotExpand(boolean isExpand) { 
    if(getFragmentViewHolder() != null) { 
     this.isExpand = isExpand; 
     // AppBarLayout variable 
     getFragmentViewHolder().appbar.setExpanded(isExpand); 
    } 
} 

당신이 스택을 다시 추가 할 때 다음 코드 아래 연락처 : - 코드 아래 onFragmentViewHolderCreated 쓰기에

// write below code where you want to stick your toolbar 
setTitleNotExpand(false); 


// write below code where you want not to stick your toolbar 
setTitleNotExpand(true); 

: -

getFragmentViewHolder().appbar.setExpanded(isExpand);