after using setSelection(int, false) like suggested here because i had troubles using the default setSelection(int) for initial setup it turns out that using the two param version messes up the spinner layout till the first manual selection takes place, details see image below. Is there a way to "update" the spinner layout?
Asked
Active
Viewed 723 times
1
-
Well - so it turn's out running `Spinner.requestLayout()` fixes the problem but only works after the layouting is finished. NOW: what event can i look after so i know the "initial" layout is rendered and i can call `Spinner.requestLayout()`? – omni Jan 29 '12 at 02:03
1 Answers
0
Okay i got it. I extedned the Spinner Class, added a var for saveing that this is the "first" pass and have overrwitten the onDraw method. after super.OnDraw() is called i can be sure that the layout has been drawn the first time and all data is passed to the spinner so to following requestLayout() will fix any layout errors. so i just test if this is the first onDraw with my var, if so i call requestLayout() and set the var to false. it's not the best way and maybe there is another event i could use that is run bevore the draw happens, but it's good enough for my needs.

omni
- 4,104
- 8
- 48
- 67