3

I am modifying an Activity to implement onConfigurationChanged(...) and it contains a extended Gallery whose members are sized manually using their LayoutParams from the Gallery's adapter.

Unfortunately the Gallery initially displays wrong: the extended View fills the whole screen. As soon as another item is selected, though, the View displays with the correct size.

As an experiment, I tried freezing the dimensions of the selected View from the Gallery#onConfigurationChanged(...) method and the same behaviour occurred, suggesting the View has been updated, but the Gallery isn't showing the change.

I also tried calling both invalidate() and postInvalidate() on the Gallery from Activity#onConfigurationChanged(...). Nothing.

How can I force the Gallery to redraw with the correct dimensions for the View?

spraff
  • 32,570
  • 22
  • 121
  • 229
Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96

1 Answers1

0

Calling notifyDataSetChanged() on your gallery adapter should do the job.

If it does not, it may be something wrong with your codes somewhere.

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
nellute
  • 846
  • 7
  • 5