I am calling the setLayoutParams in a click event of another button. The button size is being changed visually, but also after a very short timespan.
Jan On 4 aug, 13:57, Sarwar Erfan <erfanonl...@gmail.com> wrote: > Hi, > Is your button size being changed visually? (just to make sure) > > And, where are you calling the setLayoutParams method? In some event? > > Regards > Sarwar Erfan > > On Aug 4, 5:16 pm, Jan Meskens <meskens...@gmail.com> wrote: > > > > > Thanks for your reply. But the problem is that this solution can only > > be applied to custom widgets (which are subclassed fromt View) and > > thus can override the protected onSizeChanged. > > > How can I do it for existing widgets without making a custom class? > > > Jan > > > On 4 aug, 12:23, Sarwar Erfan <erfanonl...@gmail.com> wrote: > > > > protected void onSizeChanged (int w, int h, int oldw, int oldh) > > > > On Aug 4, 2:30 pm, Jan Meskens <meskens...@gmail.com> wrote: > > > > > Hi all, > > > > > I am currently looking for a way to detect that a view has been > > > > resized. It seems that there is some time between calling a resize > > > > method and when it is actually resized > > > > > For example: > > > > > [code] > > > > //I give a certain width and height > > > > button.setLayoutParams(new LinearLayout.LayoutParams(100,200)); > > > > //Now, I check the components width and height > > > > Log.v(TAG, "Size = "+button.getWidth() + "," + button.getHeight()); > > > > [/code] > > > > > Unfortunately, the received width and height is still the old one. I > > > > already tried to call button.invalidate(), but this doesn't solve the > > > > problem either... . > > > > > Is there any workaround to receive a components height/width right > > > > after it has been resized? In java awt/swing there is the > > > > ComponentListener (http://download.oracle.com/javase/6/docs/api/java/ > > > > awt/event/ComponentListener.html) for resolving these problems. Is > > > > there any alternative available in Android? > > > > > Cheers, > > > > Jan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en