title: Set random position to ImageView at start
body: <p>I have 8 ImageViews on my RelativeLayout.
  When activity onCreate it starts method init:</p>
  
  <pre><code> private void init() {
          gameFieldView = (RelativeLayout) getGameFieldView();
          mainView = (LinearLayout) getMainView();
          topOffset = mainView.getHeight() - gameFieldView.getHeight() - 6;
          // THERE ARE 0 height and width of gameFieldView, and mainView 
          for (int i = 0; i &lt; LETTERS_NUMBER; i++) {
              ImageView letter = (ImageView) findViewById(R.id.e1_letter + i);
              generateRandomPosition(random, letter); // When i comment this line it is ok (What kind of sorcery is this?), but i want to set random position to ImageView "letter"
          }
      }
  </code></pre>
  
  <p>Now generateRandomPosition looks like</p>
  
  <pre><code>private void generateRandomPosition(Random random, ImageView letter) {
          int height = letter.getHeight();
          int width = letter.getWidth();
          int top = random.nextInt(gameFieldView.getMeasuredHeight() - height - topOffset); // It obviously crashes because of IllegalArgumentException - parameter &lt; 0 because of gameFieldView height = 0 
          int left = random.nextInt(gameFieldView.getMeasuredWidth() - width);
          letter.layout(left, top, left + width, top + height);
      }
  </code></pre>
  
  <p>What am I doing wrong? Thanks in advance.</p>
  
  <p><strong>upd.</strong>
  By the way, i tried to call init() in onWindowFocusChanged, it solves the problem with IllegalArgumentException, top and left counts in the right way, but imageview stays in left top corner even after letter.layout()</p>