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 <[email protected]> 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 <[email protected]> wrote:
>
> > protected void  onSizeChanged  (int w, int h, int oldw, int oldh)
>
> > On Aug 4, 2:30 pm, Jan Meskens <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to