Just a guess, but I think you are trying to use a FILL_PARENT width where you should have a WRAP_CONTENT and maybe set a weight value if you want it to expand.
On Apr 24, 7:11 pm, kingkung <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm simply trying to programatically add an EditText and a Spinner on > the same row. But everytime I run this code, all I see is the > EditText object which has extended the width of the screen, and I > don't see the Spinner at all. > > Android seems to ignore the width and height (100,50) I set for the > EditText. > > When I run this code with the EditText commented out, all I see is the > Spinner spanning the width of the screen (so it ignores the Spinner > dimensions I set as well...) > > Anyone know how I can fix this? > > Thanks, > > James > > *********************************** > > LinearLayout ll = new LinearLayout(this); > ll.setLayoutParams(new LayoutParams( > LayoutParams.WRAP_CONTENT, > LayoutParams.FILL_PARENT)); > > EditText et = new EditText(this); > et.setLayoutParams(new LayoutParams(100,50); > ll.addView(et); > > Spinner s = new Spinner(this); > s.setLayoutParams(new LayoutParams(100,40); > s.setAdapter(new > ArrayAdapter<String>(this,R.layout.spinner_text,attrs)); > ll.addView(s); > > table.addView(ll,new TableLayout.LayoutParams( > > LayoutParams.WRAP_CONTENT, > > LayoutParams.FILL_PARENT)); > > ************************************* --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

