OnScrollChanged() called from scrollTo(x,y) but doesn't update view sizes inside the ScrollView
<p>I have been writing a code to create a magnifying glass effect on ImageViews inside a scrollView. (I want to change the size of the ImageViews in the center to be bigger than the ones on the sides)
I inherited HorizonalScrollView and overrode <code>onScrollChanged()</code>.
In <code>OnScrollChanged</code> I changed the ImageViews size according to its location on the screen.
(I changed the size with <code>LinearLayout.LayoutParams</code>)
Everything is working, but when I tried to move the scrollView to the center, 
via  <code>scrollTo()</code> in a <code>scrollview.post()</code> runnable, the scrollview moves to the specified location and <code>onScrollChanged()</code> is called but the ImageViews inside the scrollView don't change their size properly (they change their size randomly).
Only when I touch the screen and move the scrollView with my finger, the views change their size properly.</p>

<p>The main code :</p>

<pre><code>public class Scroll extends Activity implements ScrollViewListener{
     /** Called when the activity is first created. */
 LinearLayout container;
 ObservableScrollView myScroll;
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);

    container=(LinearLayout)findViewById(R.id.linearLayout1);
  myScroll=(ObservableScrollView)findViewById(R.id.horizontalScrollView1);
  myScroll.setScrollViewListener(this);
   for(int i=0;i&lt;30;i++)
   {
        ImageView img=new ImageView(this);
        img.setImageResource(R.drawable.icon);
        container.addView(img);
   }


      myScroll.post(new Runnable() {
      @Override
       public void run() {
          myScroll.scrollBy(500,0);

    } 
    });







   }
@Override
public void onScrollChanged(ObservableScrollView scrollView, int x, int y,
        int oldx, int oldy) {


    int count=container.getChildCount();
     int [] xy={0,0};
        container.getChildAt(count-1).getLocationOnScreen(xy);


            int x1=xy[0];



        for(int i=0;i&lt;count;i++)
            AdjustSize((ImageView)container.getChildAt(i));






}



        private void AdjustSize(ImageView image)
           {




            if(image.getVisibility()==View.VISIBLE){
               int [] xy={0,0};
                image.getLocationOnScreen(xy);
                int x1=xy[0];
                if((x1&gt;10)&amp;&amp;(x1&lt;790))
                {
                double xSize=220-(0.5*220*((Math.abs(x1-300)))/400);
                int xInt=(int)xSize;


                    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(xInt,xInt);




                lp.gravity=Gravity.CENTER;   

                     image.setLayoutParams(lp);
                }
                     // image.setLayoutParams(new LinearLayout.LayoutParams(xInt, xInt));

               }


                }

          }
</code></pre>
