Re: [android-developers] How come LinearLayout doesn't seem to measure wrap_content properly

2012-10-22 Thread Romain Guy
LinearLayout is doing the right thing. wrap_content results in an
AT_MOST MeasureSpec. If you are writing a custom view that extends the
base View class you really should override onMeasure().

On Mon, Oct 22, 2012 at 2:33 PM, Satya Komatineni
satya.komatin...@gmail.com wrote:
 I am doing more research to see if this indeed is the case. But here
 are the symptoms


 LinearLayoutheight=wrap_conent
textviewheight=wrap_content
   some-custom-circle-viewheight=wrap_content
   textview ..height=wrap_content
 /LinearLayout

 In the custom circleview constructor I set the minimum height and width.

 I was hoping these minimum sizes will be used if the height of my
 custom view is wrap_content. But looks like linear layout never
 sends out the unspeicified but only does the 'at_most' making the
 getDefaultSIze return the entire space after the first text view. In
 fact the last textview is beyond the screen below.

 Do I have to write onMeasure() in the custom view and deal with
 wrap_content separately? why is LinearLayout not measuring the
 desired size?

 Your insights are greatly appreciated

 Thanks
 Satya

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



-- 
Romain Guy
Android framework engineer
romain...@android.com

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


Re: [android-developers] How come LinearLayout doesn't seem to measure wrap_content properly

2012-10-22 Thread Satya Komatineni
Does wrap_content always result in AT_MOST?

If it says 411 pixles at most, I would have thought I will take all of
it because I could use that. I would not have thought to give back my
content size. Just thinking aloud.

what will match_parent do? Does that come in as EXACT, matching
the size of the parent?

Thank you so much for your help. It saved me hours of agony that I am
about to jump into  ...
Satya

On Mon, Oct 22, 2012 at 5:40 PM, Romain Guy romain...@android.com wrote:
 LinearLayout is doing the right thing. wrap_content results in an
 AT_MOST MeasureSpec. If you are writing a custom view that extends the
 base View class you really should override onMeasure().

 On Mon, Oct 22, 2012 at 2:33 PM, Satya Komatineni
 satya.komatin...@gmail.com wrote:
 I am doing more research to see if this indeed is the case. But here
 are the symptoms


 LinearLayoutheight=wrap_conent
textviewheight=wrap_content
   some-custom-circle-viewheight=wrap_content
   textview ..height=wrap_content
 /LinearLayout

 In the custom circleview constructor I set the minimum height and width.

 I was hoping these minimum sizes will be used if the height of my
 custom view is wrap_content. But looks like linear layout never
 sends out the unspeicified but only does the 'at_most' making the
 getDefaultSIze return the entire space after the first text view. In
 fact the last textview is beyond the screen below.

 Do I have to write onMeasure() in the custom view and deal with
 wrap_content separately? why is LinearLayout not measuring the
 desired size?

 Your insights are greatly appreciated

 Thanks
 Satya

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



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

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

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


Re: [android-developers] How come LinearLayout doesn't seem to measure wrap_content properly

2012-10-22 Thread Romain Guy
When you receive an AT_MOST mesure spec you can return any size you
want as long as it's = to the MeasureSpec's size. match_parent is
indeed EXACTLY + size of the parent.

On Mon, Oct 22, 2012 at 3:05 PM, Satya Komatineni
satya.komatin...@gmail.com wrote:
 Does wrap_content always result in AT_MOST?

 If it says 411 pixles at most, I would have thought I will take all of
 it because I could use that. I would not have thought to give back my
 content size. Just thinking aloud.

 what will match_parent do? Does that come in as EXACT, matching
 the size of the parent?

 Thank you so much for your help. It saved me hours of agony that I am
 about to jump into  ...
 Satya

 On Mon, Oct 22, 2012 at 5:40 PM, Romain Guy romain...@android.com wrote:
 LinearLayout is doing the right thing. wrap_content results in an
 AT_MOST MeasureSpec. If you are writing a custom view that extends the
 base View class you really should override onMeasure().

 On Mon, Oct 22, 2012 at 2:33 PM, Satya Komatineni
 satya.komatin...@gmail.com wrote:
 I am doing more research to see if this indeed is the case. But here
 are the symptoms


 LinearLayoutheight=wrap_conent
textviewheight=wrap_content
   some-custom-circle-viewheight=wrap_content
   textview ..height=wrap_content
 /LinearLayout

 In the custom circleview constructor I set the minimum height and width.

 I was hoping these minimum sizes will be used if the height of my
 custom view is wrap_content. But looks like linear layout never
 sends out the unspeicified but only does the 'at_most' making the
 getDefaultSIze return the entire space after the first text view. In
 fact the last textview is beyond the screen below.

 Do I have to write onMeasure() in the custom view and deal with
 wrap_content separately? why is LinearLayout not measuring the
 desired size?

 Your insights are greatly appreciated

 Thanks
 Satya

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



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

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

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



-- 
Romain Guy
Android framework engineer
romain...@android.com

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