title: Custom ListView with Pinned Header , causing Jank when setting padding
body: <p>I have a custom listView which contains one pinned header, and x amounts of "push-up" views, which can be pushed up and hidden above the list view.</p>
  
  <p>I have attached image to explain them. Sorry for the "black censorship", just to hide customers logo etc.</p>
  
  <p>My problem is that if I add a padding to the pinned Header view, I will get the listview items floating behind it. </p>
  
  <p>The pinned header view, is implemented with the same technique as you'll find if you search for PinnedHeaderListView , that is, a static view and a Header in the listview.</p>
  
  <p>I have a found a way to enable padding, and that is by applying the same padding as the pinned header, to the actual listView, but only when the static header is visible. </p>
  
  <p>However, the calling of setPadding causes a quite visible Jank which I would like to remove. 
  Does anyone have any idea how to remove this jank?</p>
  
  <p>I have a simple application with simple views and dummy data, which does not show this jank, so maybe the amount of jank depends on the complexity of cell layouts.</p>
  
  <pre><code>private void updateIfShouldShowStaticHeaderView() {
  
      //unfortunately setting the padding of the listView causes JANK.
  
      //any ideas?
      int bottomOfFloatingHeader = floatingHeader.getBottom();
      if (bottomOfFloatingHeader &lt; mHeaderViewHeight) {
          staticHeaderViewIsVisible = true;
          staticHeader.setVisibility(View.VISIBLE);
  
          //need to set padding of listView to avoid having list-view items float behind my padded static header
          setPadding(0, staticHeader.getPaddingTop(), 0, getPaddingBottom());
      } else {
          staticHeaderViewIsVisible = false;
          staticHeader.setVisibility(View.INVISIBLE);
          //need to set padding of listView to avoid having list-view items float behind my padded static header
          setPadding(0, 0, 0, getPaddingBottom());
      }
  }
  </code></pre>
  
  <p>First here is the image showing the pushed-up headers
  <img src="https://i.stack.imgur.com/9loxL.png" alt="showing the pushed-up headers"></p>
  
  <p>Here is an image showing how things get drawn behind the padded static pinned view.
  It is worth noticing that it works as intented if I adjust the padding of the listView, but I will get Jank (slowdown) , at the time it switches on/off the static header view.</p>
  
  <p><img src="https://i.stack.imgur.com/NrQmS.png" alt="showing the error that is visible if I do not adjust padding"></p>