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?
Calling
notifyDataSetChanged()on your gallery adapter should do the job.If it does not, it may be something wrong with your codes somewhere.