[android-developers] Re: Simple LinearLayout Question

2010-02-01 Thread jarnaud
Hello, yes, equal weights is the way to do it.
Could you share your layout code?
--
Jay
Complete Android Tutorials: http://android.voxisland.com

On Jan 31, 3:49 am, scastria scastria...@gmail.com wrote:
 Maybe I am missing something here:

 I have a simple horizontal LinearLayout with fill_parent set
 containing 3 TextViews inside it.  I have set each of the TextViews to
 have 1.0 weight.  My goal was to get each TextView to take up 33% of
 the LinearLayout.  This sort of works, but the TextView sizes change
 depending on the text of the TextView.  The TextView with the longest
 string is taking up slightly more space than the other two TextViews
 with shorter strings.  Since each of the TextViews have equal weights,
 they should be evenly distributed across their parent regardless of
 the text inside, correct?

-- 
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


[android-developers] Re: Simple LinearLayout Question

2010-01-31 Thread Lance Nanek
The weight controls how the remaining space is used after the sizes
are taken into account. That's why you often see width/height set to
zero where weight is used.

On Jan 31, 3:49 am, scastria scastria...@gmail.com wrote:
 Maybe I am missing something here:

 I have a simple horizontal LinearLayout with fill_parent set
 containing 3 TextViews inside it.  I have set each of the TextViews to
 have 1.0 weight.  My goal was to get each TextView to take up 33% of
 the LinearLayout.  This sort of works, but the TextView sizes change
 depending on the text of the TextView.  The TextView with the longest
 string is taking up slightly more space than the other two TextViews
 with shorter strings.  Since each of the TextViews have equal weights,
 they should be evenly distributed across their parent regardless of
 the text inside, correct?

-- 
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


[android-developers] Re: Simple LinearLayout Question

2010-01-31 Thread dye...@wivsys.com
Why don't you take a look at the following blog:

http://andmobidev.blogspot.com/2010/01/setting-width-of-view-using-percentage.html

Regardless of text length--as you were expecting--I was able to show
three equal-width TextViews. The combination of android:weightSum,
android:layout_weight, and android:layout_width seemed to work.

On Jan 31, 12:49 am, scastria scastria...@gmail.com wrote:
 Maybe I am missing something here:

 I have a simple horizontal LinearLayout with fill_parent set
 containing 3 TextViews inside it.  I have set each of the TextViews to
 have 1.0 weight.  My goal was to get each TextView to take up 33% of
 the LinearLayout.  This sort of works, but the TextView sizes change
 depending on the text of the TextView.  The TextView with the longest
 string is taking up slightly more space than the other two TextViews
 with shorter strings.  Since each of the TextViews have equal weights,
 they should be evenly distributed across their parent regardless of
 the text inside, correct?

-- 
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