If your ImageView has a LinearLayout parent then you would write:

myImageView.setLayoutParams(new LinearLayout.LayoutParams(....));

If your ImageView has a FrameLayout parent, then you would write:

myImageView.setLayoutParams(new FrameLayout.LayoutParams(....));

And so on. This is why the LayoutInflater.inflate() method takes a
parent as an argument. The parent parameter is used to infer the type
of LayoutParams. That might be your bug if you are not building your
UI from Java code.

On Sun, Mar 25, 2012 at 2:17 PM, Jim Graham <spooky1...@gmail.com> wrote:
> On Sun, Mar 25, 2012 at 01:55:12PM -0700, Romain Guy wrote:
>> LinearLayout is not a FrameLayout. I just remembered that ScrollView
>> *is* a FrameLayout, my bad. The layout params of the ScrollView's
>> child should be ScrollView.LayoutParams (or FrameLayout.LayoutParams.)
>> A child must always use the layout params type declared in its parent.
>
> Ok, now I'm REALLY confused.  Let me see if I've got this right (and I'm
> not the least bit sure that I do).  If I have the following,
>
> <LinearLayout ....>
>   <ImageView .....>
>   </ImageView>
> </LinearLayout>
>
> To set parameters (e.g., scaleType, width, height, alpha (for the whole
> ImageView), etc., for the ImageView, I'm supposed to be setting it using
> LinearLayout.LayoutParams?  That's how I read the text above, but it
> sounds very, VERY strange.
>
> Later,
>   --jim
>
> --
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)        MiSTie #49997  < Running FreeBSD 7.0 >
> spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W
>
>      "'Wrong' is one of those concepts that depends on witnesses."
>     --Catbert:  Evil Director of Human Resources (Dilbert, 05Nov09)
>
> Android Apps Listing at http://www.jstrack.org/barcodes.html
>
> --
> 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

Reply via email to