2 messages in com.googlegroups.android-beginners[android-beginners] trouble dynamical...| Subject: | [android-beginners] trouble dynamically adding LinearLayout with 2 subviews![]() |
|---|---|
| From: | kingkung (king...@gmail.com) |
| Date: | 04/24/2008 07:11:02 PM |
| List: | com.googlegroups.android-beginners |
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 andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---




