How to Change size of View

Put your problem here if it does not fit any of the other categories.

How to Change size of View

Postby uzair77 » Mon May 31, 2010 7:27 am

Hi i have Button,
I have set its width and height using

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(80,80 );


I want to change its size bigger when user touch it,,

I am trying to do setlayoutparams on Touch listner
but its not work fine,,

How i do it
any suggestion ///


thanks
uzair77
Junior Developer
Junior Developer
 
Posts: 24
Joined: Wed Mar 24, 2010 10:57 am

Top

Re: How to Change size of View

Postby anarche » Mon May 31, 2010 1:49 pm

This can be tricky.

I've successfully done this altering the original LayoutParams

Code: Select all
LinearLayout.LayoutParams lps = LinearLayout.getLayoutParams
lps.height = 80
lps.width = 80


Its not very cute code - thank google for making the fields public - but its worked.

Having said that I've seen the above code break on me, so I stopped using it.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests