title: Help with Compund View and onLayout and onMeasure (HorizontalScrollView)
body: <p>I want to create my own compound view. This view will extend a LinearLayout, and have a HorizontalScrollView in it. This HorizontalScrollView will hold a parent LinearLayout that will hold several TextView.</p>
  
  <p>What I want to achieve is like an Alphabet Horizontal Index. With the above approach it works just fine. But it is not enough.</p>
  
  <p>Right now letter A can not be at the center of the scroll, as it is the first letter, and you can not scroll more to the left. What I want to achieve is that the user can scroll to the left until the point where the first letter (A) is in the center. And that it works the same way when scrolling to the right and the last letter (Z).</p>
  
  <p>I am very confused about how to do this. I know I can set padding to the inner LinearLayout in scroll, but I have to wait until I know how wide the scroll is (it's size is dynamic, FILL_PARENT). I can get this size in onLayout method, calling getMeasuredWidth. Then I can update the inner LinearLayout padding with the desired values, but it looks like eventhough I change the padding, the width of the innerLayout does not change.</p>
  
  <p>I have also tried adding 2 spacers (just views) before A and after Z, but the paradigm is the same. I need to change its size when I know about the width of the scroll.</p>
  
  <p>Please, help! :D</p>
  
  <p>I can post some code if needed.</p>
  
  <p>EDIT with image:
  <img src="https://i.stack.imgur.com/0sH8q.png" alt="enter image description here"></p>
  
  <p>So I want to be able to scroll more to the left, just until letter A is in the middle.</p>
  
  <p>Help! Thanks.</p>