Skip to content

Commit

Permalink
fix: StickyTitle 和 ItemView 重叠显示的问题
Browse files Browse the repository at this point in the history
- 向上滑动的时候,new title 把 old title顶上去的一瞬间,RecyclerView中的ItemView和StickyTitle重叠显示,继续向上滑动,可以明显的看到两个Titie重叠显示。
  • Loading branch information
eric committed Mar 1, 2017
1 parent c5f95e9 commit 6cb6c84
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (mStickyViewHolder != null && list.size() > firstItemPosition) {
EntityWrapper wrapper = list.get(firstItemPosition);
String wrapperTitle = wrapper.getIndexTitle();

if (EntityWrapper.TYPE_TITLE == wrapper.getItemType()) {
mLayoutManager.findViewByPosition(firstItemPosition).setVisibility(INVISIBLE);
}
// hide -> show
if (wrapperTitle == null && mStickyViewHolder.itemView.getVisibility() == VISIBLE) {
mStickyTitle = null;
Expand All @@ -351,6 +353,9 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (nextTitleView.getTop() <= mStickyViewHolder.itemView.getHeight() && wrapperTitle != null) {
mStickyViewHolder.itemView.setTranslationY(nextTitleView.getTop() - mStickyViewHolder.itemView.getHeight());
}
if (INVISIBLE == nextTitleView.getVisibility()) {
nextTitleView.setVisibility(VISIBLE);
}
} else if (mStickyViewHolder.itemView.getTranslationY() != 0) {
mStickyViewHolder.itemView.setTranslationY(0);
}
Expand Down

0 comments on commit 6cb6c84

Please sign in to comment.