amarjain07 / StickyScrollView

Sticky header and footer for android ScrollView.
MIT License
533 stars 86 forks source link

Transparent header layout #1

Closed anishjohnrc closed 7 years ago

anishjohnrc commented 7 years ago

The items are overlapping if I define the header layout as transparent. Can you help me on that?

amarjain07 commented 7 years ago

@anishjohnrc That is how it is expected to work because all the other views scroll normally while the header sticks on the top and when the other views pass behind the header, they appear to be overlapping. You could do the following to avoid that.

scrollView.setScrollViewListener(new IScrollViewListener() {
      @Override
      public void onScrollChanged(int l, int t, int oldl, int oldt) {
            if(scrollView.isHeaderSticky()){
                    findViewById(R.id.headerLayout).setBackgroundResource(android.R.color.white);
            }else{
                    findViewById(R.id.headerLayout).setBackgroundResource(android.R.color.transparent);
            }
      }
      @Override
      public void onScrollStopped(boolean isStoped) {

      }
 });