[android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Jim Graham
I'm trying to build the layout for my camera app. The camera preview goes on the left, and is set to the largest supported size that fits within 65% of the display width and 100% of the display height. The remaining 35% of the width is for two things: first, a TableLayout (set inside of a

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread YuviDroid
By reading this: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams I'd say you need to change this: msettingsLayout.setLayoutParams(new LinearLayout.LayoutParams(settingsw, settingsh)); into: msettingsLayout.setLayoutParams(new

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Jim Graham
On Sun, Mar 25, 2012 at 10:14:12PM +0200, YuviDroid wrote: By reading this: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams I'd say you need to change this: msettingsLayout.setLayoutParams(new LinearLayout.LayoutParams(settingsw,

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Romain Guy
It might now be a FrameLayout but a subclass of a FrameLayout. You can see that the problem happens inside a ScrollView. What ScrollViews do you have and what do you put in them? On Sun, Mar 25, 2012 at 1:20 PM, Jim Graham spooky1...@gmail.com wrote: On Sun, Mar 25, 2012 at 10:14:12PM +0200,

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Jim Graham
On Sun, Mar 25, 2012 at 01:35:14PM -0700, Romain Guy wrote: It might now be a FrameLayout but a subclass of a FrameLayout. You can see that the problem happens inside a ScrollView. What ScrollViews do you have and what do you put in them? I should have mentioned---it happened before I put in

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Romain Guy
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. On Sun, Mar 25, 2012

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Jim Graham
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

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread YuviDroid
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. Yep, that's right. On Sun, Mar 25, 2012 at 11:17

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Romain Guy
No it's not. Only layout_* attributes map to LayoutParams. On Sun, Mar 25, 2012 at 2:22 PM, YuviDroid yuvidr...@gmail.com wrote: 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

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread YuviDroid
Actually.you need to use LinearLayout.LayoutParams to set the layout parameters. scaleType, alpha are the ImageView parameters. Basically, anything that start with layout_ is a layout parameter. On Sun, Mar 25, 2012 at 11:22 PM, YuviDroid yuvidr...@gmail.com wrote: To set parameters (e.g.,

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Romain Guy
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

Re: [android-developers] XML Layout SERIOUSLY misbehaving

2012-03-25 Thread Jim Graham
On Sun, Mar 25, 2012 at 02:25:20PM -0700, Romain Guy wrote: 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: