Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old January 24th, 2012, 03:10 PM   #1 (permalink)
Junior Member
 
jonathanrz's Avatar
 
Join Date: Jan 2012
Location: Brazil - Blumenau, SC
Posts: 69
 
Device(s): Motorola Defy - Gingerbread(2.3.3)
Thanks: 12
Thanked 5 Times in 4 Posts
Send a message via MSN to jonathanrz jonathanrafaelz
Question Problem with setLayoutParams and weight

I'm having problem changing the weight of a view by code.

I have two views, each one with weight of 1, when I change the weight of one to 2, then the opposite occurs, the view that have weight 1 occupies 66% of the screen and the view that have weight 2 occupies 33% of the screen.

The code:

View view = findViewById(R.id.view1);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)view.getLayoutParams();

params.weight += 1f;

view.setLayoutParams(params);

jonathanrz is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:08 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo