try to use l1.setOrientation(...) just before l1.addView(...)
On Jun 25, 4:42 pm, "Mr.No" <f.hi...@arcor.de> wrote: > Ive tried it with layoutparams its the same. > the default layoutarams will be assigned to the layout. > > On 25 Jun., 16:26, Peli <peli0...@googlemail.com> wrote: > > > You have not set any layout > > parameters.http://developer.android.com/reference/android/widget/LinearLayout.La... > > > l2.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, > > LayoutParams.WRAP_CONTENT)); > > > Peliwww.openintents.org > > > On Jun 25, 3:28 pm, "Mr.No" <f.hi...@arcor.de> wrote: > > > > Hi folks, > > > ive a little problem: > > > > Why is the following code causing an exception? > > > The Code throws a "mBaselineAlignedChildIndex of LinearLayout set to > > > an index that is out of bounds" exception. > > > > public void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > setContentView(R.layout.main); > > > > LinearLayout l1 = new LinearLayout(this); > > > LinearLayout l2 = new LinearLayout(this); > > > l1.addView(l2); > > > this.setContentView(l1); > > > > } > > > > If l2 is dont added to l1 than it works. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---