What is the best workaround for uncertain jump progress in ICS?

I have a custom layout that contains a progress bar over the main ListView. When the list is updated, I set the progress bar to indefinite. On JellyBean and above, this works well. However, in IceCream Sandwich, when set to undefined, it jumps a few pixels higher, enough to hide part of it in the ActionBar.

What would be the best way to get around this behavior?

Do you have two lanes with different marginTop values ​​and switch between them, changing the appearance of the view when changing between deterministic and undefined modes? Changing the settings of the LayoutParams progress bar when changing modes? Or in some other way?

In both cases, I can do selective processing, so in the first case I would set different layouts for different versions of the API, and in the second I would change only LayoutParams if the SDK_INT value is less than 16.

Is there a better way to get around behavior? If not, which one will be "better"? It would probably be better here in terms of less use of resources and / or maintainability, but I would also be interested in the pros and cons of them.

+6
source share
1 answer

Consider setting a maximum execution interval to be a timeout for an update. Therefore, if you set a timeout of 60 seconds, use a counter to update the progress bar every second until it expires. Then it will always be a defining indicator of progress.

0
source

All Articles