0

In "onCreate" I have this code here:

    imageView1 = (ImageView) findViewById(R.id.imageView1);
    imageView2 = (ImageView) findViewById(R.id.imageView2);
    imageView3 = (ImageView) findViewById(R.id.imageView3);

    // ...

    imageView1.getLayoutParams().width = imgViewWidth;
    imageView2.getLayoutParams().width = imgViewWidth;
    imageView3.getLayoutParams().width = imgViewWidth;

Now,

  1. The app starts
  2. I see the background (solid color)
  3. Then, the images appear

What can I do, that the resized images appear before the app starts?

Johnny
  • 612
  • 3
  • 13
  • 32

1 Answers1

0

You can resize it in onCreate. See this http://developer.android.com/training/basics/activity-lifecycle/index.html

QArea
  • 4,955
  • 1
  • 12
  • 22
  • But, why the images appear after the app starts? It looks not good. – Johnny Sep 10 '14 at 12:49
  • An activity is created after onCreate method, then check the cycle of your code. – juanhl Sep 10 '14 at 12:58
  • Hmm.. I resize the images under "onWindowFocusChanged" too. Maybe this is the problem? – Johnny Sep 10 '14 at 13:08
  • I know where is the problem. In "onCreate" I can't getMeasuredWidth(). It's added to imgViewWidth. I can't get the getMeasuredWidth(). – Johnny Sep 10 '14 at 13:18