[android-developers] XML Layout SERIOUSLY misbehaving
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 ScrollView) with textviews and spinners (side by side) for spinner labels and the spinners themselves. Below that is a LinearLayout (horizontal) for a TextView and the shutter release image. The left side works fine. No problem. The right side works fine on my tablet, but not on my phone (Motorold Bravo MB520). What inevitably happens with the layout on my phone is the textviews/spinners taking the full screen, and the shutter release button is nowhere to be seen. I've played around with the weights, and nothing seems to change the end result. I've tried setting the width and height of the image from Java...nothing. I've tried resizing the image and changing its density...no change. I've tried setting the width and height of the two layouts on the left (when both were LinearLayouts ... before the TableLayout), and every time I've tried to do this, I get a force close with the logcat data shown below, saying that android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams. Just one problem: NOWHERE in any my project will you find the word Frame (ignoring case for the fgrep). Logcat output (relevant to the force close): --- CUT HERE --- 2012-03-25 14:43:42.320 E 24222/AndroidRuntime: FATAL EXCEPTION: main java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams at android.widget.FrameLayout.onMeasure(FrameLayout.java:268) at android.widget.ScrollView.onMeasure(ScrollView.java:308) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284) at android.widget.LinearLayout.measureVertical(LinearLayout.java:613) at android.widget.LinearLayout.onMeasure(LinearLayout.java:519) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:956) at android.widget.LinearLayout.onMeasure(LinearLayout.java:521) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.FrameLayout.onMeasure(FrameLayout.java:267) at android.view.View.measure(View.java:10828) at android.widget.LinearLayout.measureVertical(LinearLayout.java:764) at android.widget.LinearLayout.onMeasure(LinearLayout.java:519) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.FrameLayout.onMeasure(FrameLayout.java:267) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:1912) at android.view.View.measure(View.java:10828) at android.view.ViewRoot.performTraversals(ViewRoot.java:938) at android.view.ViewRoot.handleMessage(ViewRoot.java:2040) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:132) at android.app.ActivityThread.main(ActivityThread.java:4123) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:491) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at dalvik.system.NativeStart.main(Native Method) --- CUT HERE --- I should point out that I have imported android.widget.LinearLayout and android.widget.LinearLayout.LayoutParams, and the variables for the layouts are defined, e.g., LinearLayout msettingsLayout; and set by reference to their resource ID, e.g., msettingsLayout = (LinearLayout) findViewById(R.id.settingsLayout); Changes to the width and height are set: msettingsLayout.setLayoutParams(new LinearLayout.LayoutParams(settingsw, settingsh)); And this is where the force close happens; comment out this line (and the other one that differs only in variable/layout names), no force close. I've double-checked my use of the above in the Dev Guide, and in several Android programming books that I have (print versions and eBook versions, as well as online tutorials and old apps of mine), and unless I've just missed something (like a typo, etc.), it
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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 *FrameLayout*.LayoutParams(settingsw, settingsh)); This is most probably because your LinearLayout msettingsLayout is inside a FrameLayout, and so its layout params must be of its parent class. Cheers, Yuvi DroidAhead http://www.droidahead.com On Sun, Mar 25, 2012 at 10:09 PM, Jim Graham spooky1...@gmail.com wrote: 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 ScrollView) with textviews and spinners (side by side) for spinner labels and the spinners themselves. Below that is a LinearLayout (horizontal) for a TextView and the shutter release image. The left side works fine. No problem. The right side works fine on my tablet, but not on my phone (Motorold Bravo MB520). What inevitably happens with the layout on my phone is the textviews/spinners taking the full screen, and the shutter release button is nowhere to be seen. I've played around with the weights, and nothing seems to change the end result. I've tried setting the width and height of the image from Java...nothing. I've tried resizing the image and changing its density...no change. I've tried setting the width and height of the two layouts on the left (when both were LinearLayouts ... before the TableLayout), and every time I've tried to do this, I get a force close with the logcat data shown below, saying that android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams. Just one problem: NOWHERE in any my project will you find the word Frame (ignoring case for the fgrep). Logcat output (relevant to the force close): --- CUT HERE --- 2012-03-25 14:43:42.320 E 24222/AndroidRuntime: FATAL EXCEPTION: main java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams at android.widget.FrameLayout.onMeasure(FrameLayout.java:268) at android.widget.ScrollView.onMeasure(ScrollView.java:308) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284) at android.widget.LinearLayout.measureVertical(LinearLayout.java:613) at android.widget.LinearLayout.onMeasure(LinearLayout.java:519) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:956) at android.widget.LinearLayout.onMeasure(LinearLayout.java:521) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.FrameLayout.onMeasure(FrameLayout.java:267) at android.view.View.measure(View.java:10828) at android.widget.LinearLayout.measureVertical(LinearLayout.java:764) at android.widget.LinearLayout.onMeasure(LinearLayout.java:519) at android.view.View.measure(View.java:10828) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351) at android.widget.FrameLayout.onMeasure(FrameLayout.java:267) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:1912) at android.view.View.measure(View.java:10828) at android.view.ViewRoot.performTraversals(ViewRoot.java:938) at android.view.ViewRoot.handleMessage(ViewRoot.java:2040) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:132) at android.app.ActivityThread.main(ActivityThread.java:4123) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:491) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at dalvik.system.NativeStart.main(Native Method) --- CUT HERE --- I should point out that I have imported android.widget.LinearLayout and android.widget.LinearLayout.LayoutParams, and the variables for the layouts are defined, e.g., LinearLayout msettingsLayout; and set by reference
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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, settingsh)); into: msettingsLayout.setLayoutParams(new *FrameLayout*.LayoutParams(settingsw, settingsh)); This is most probably because your LinearLayout msettingsLayout is inside a FrameLayout, and so its layout params must be of its parent class. Ok, where's the FrameLayout? I haven't define one. As I said in the original post, even the word Frame is *NOWHERE* in my project. It''s not in the Java file. It's not in the XML files.. It's not in the Manifest. Basically (in Zsh): $ cd Android/workspace/DroidProCam $ frep -i frame **/*.xml **/*.java $ Nothing found. So, again, where IS this frame layout defined? Thanks, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4)| Tux (E Cat): DS B+Wd Y 6 Y L+++ W+ C++/C++ I+++ spooky1...@gmail.com| T++ A E H+ S V- F++ Q+++ P/P+ B++ PA+ PL SC--- Running FreeBSD 7.0 | ICBM / Hurricane: | Tiggerbelle: DS W+S+Bts % 1.5 X L W C+++/C+ 30.44406N 86.59909W | I+++ T A E++ H S++ V+++ Q+++ P B++ PA++ PL+ SC 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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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, 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, settingsh)); into: msettingsLayout.setLayoutParams(new *FrameLayout*.LayoutParams(settingsw, settingsh)); This is most probably because your LinearLayout msettingsLayout is inside a FrameLayout, and so its layout params must be of its parent class. It might n Ok, where's the FrameLayout? I haven't define one. As I said in the original post, even the word Frame is *NOWHERE* in my project. It''s not in the Java file. It's not in the XML files.. It's not in the Manifest. Basically (in Zsh): $ cd Android/workspace/DroidProCam $ frep -i frame **/*.xml **/*.java $ Nothing found. So, again, where IS this frame layout defined? Thanks, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4) | Tux (E Cat): DS B+Wd Y 6 Y L+++ W+ C++/C++ I+++ spooky1...@gmail.com | T++ A E H+ S V- F++ Q+++ P/P+ B++ PA+ PL SC--- Running FreeBSD 7.0 | ICBM / Hurricane: | Tiggerbelle: DS W+S+Bts % 1.5 X L W C+++/C+ 30.44406N 86.59909W | I+++ T A E++ H S++ V+++ Q+++ P B++ PA++ PL+ SC 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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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 the ScrollView, too. But to answer your question, as per the ScrollView docs, it can only wrap one item, and that's a LinearLayout. So is LinearLayout a subclass of FrameLayout, then? I would never have guessed that (and if it's in the docs, I never saw it). So should I change the cast for the LinearLayout params to FrameLayout, then? And do I need to import android.widget.FrameLayout? Sorry if any of these are stupid questions---I'm in unexplored territory with these problems, and have been for (how many weeks has this been driving me crazy, going from one set of documentation material to another, and another, and another, and ... ad nauseum?). As I said in my first post, I finally gave up and had to post here. Thanks, --jim PS: no need to CC me...gmail nukes the duplicate copy when it sees the duplicate Message-ID...and it'd still end up in this mbox file instead of in /var/mail thanks to my procmail filters that redirect all from this group here. :-) -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4)MiSTie #49997 Running FreeBSD 7.0 spooky1...@gmail.comICBM/Hurr.: 30.44406N 86.59909W Now what *you* need is a proper pint of porter poured in a proper pewter porter pot.. --Peter Dalgaard in alt.sysadmin.recovery 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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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 at 1:46 PM, Jim Graham spooky1...@gmail.com wrote: 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 the ScrollView, too. But to answer your question, as per the ScrollView docs, it can only wrap one item, and that's a LinearLayout. So is LinearLayout a subclass of FrameLayout, then? I would never have guessed that (and if it's in the docs, I never saw it). So should I change the cast for the LinearLayout params to FrameLayout, then? And do I need to import android.widget.FrameLayout? Sorry if any of these are stupid questions---I'm in unexplored territory with these problems, and have been for (how many weeks has this been driving me crazy, going from one set of documentation material to another, and another, and another, and ... ad nauseum?). As I said in my first post, I finally gave up and had to post here. Thanks, --jim PS: no need to CC me...gmail nukes the duplicate copy when it sees the duplicate Message-ID...and it'd still end up in this mbox file instead of in /var/mail thanks to my procmail filters that redirect all from this group here. :-) -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4) MiSTie #49997 Running FreeBSD 7.0 spooky1...@gmail.com ICBM/Hurr.: 30.44406N 86.59909W Now what *you* need is a proper pint of porter poured in a proper pewter porter pot.. --Peter Dalgaard in alt.sysadmin.recovery 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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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 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 -- YuviDroid Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget to quickly access your favorite apps and contacts!) http://android.yuvalsharon.net -- 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] XML Layout SERIOUSLY misbehaving
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 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 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 -- YuviDroid Check out Launch-X (a widget to quickly access your favorite apps and contacts!) http://android.yuvalsharon.net -- 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] XML Layout SERIOUSLY misbehaving
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., 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 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 -- YuviDroid Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget to quickly access your favorite apps and contacts!) http://android.yuvalsharon.net -- YuviDroid Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget to quickly access your favorite apps and contacts!) http://android.yuvalsharon.net -- 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] XML Layout SERIOUSLY misbehaving
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
Re: [android-developers] XML Layout SERIOUSLY misbehaving
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: myImageView.setLayoutParams(new FrameLayout.LayoutParams()); [] Ok, now THAT makes more sense. :-) And now I'm wishing I'd asked here a few weeks ago...I was, however, thinking it might belong in the beginner's group. Now I wonder which group I should have posted it in. Thanks, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4)| Peter da Silva: No, try rm -rf / spooky1...@gmail.com| Dave Aronson:As your life flashes before Running FreeBSD 7.0 | your eyes, in the unit of time known as an ICBM / Hurricane: | ohnosecond (alt.sysadmin.recovery) 30.44406N 86.59909W | 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