Adjust ImageView at runtime?

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

Adjust ImageView at runtime?

Postby ryank » Fri Mar 21, 2008 3:19 am

How do I adjust the size of an ImageView during runtime? This is the code I have used but it raises an error.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myImageView.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Top

Postby ryank » Mon Mar 24, 2008 12:54 am

anyone have any ideas on how to do this?
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby ryank » Mon Mar 24, 2008 1:01 am

nevermind, figured this one out. I needed to use RelativeLayout instead of ViewGroup.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myImageView.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby bavarol » Wed Mar 26, 2008 2:54 pm

Have you proved method setScale(), so you could adjust size.

I hope, that's you meant
bavarol
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Dec 10, 2007 9:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests