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 appears to be valid code. Does anyone have any ideas as to what might be going on here? This has been nagging me for ... well, I can't remember if it's been two or three weeks, or longer. Basically, I give up. Thanks, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4) | DMR: So fsck was originally called spooky1...@gmail.com | something else. < Running FreeBSD 7.0 > | Q: What was it called? ICBM / Hurricane: | DMR: Well, the second letter was different. 30.44406N 86.59909W | -- Dennis M. Ritchie, Usenix, June 1998. 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