One of my project I added a scrollview to a layout.And I added a
button to other layout.When i  click the button 1 button is added .But
when i clikced one more time i am get
"java.lang.IllegalStateException: ScrollView can host only one direct
child" error.I googled but all people say that you can not add
multible component to scrollview.But i am not added multible
component.Can anybody help me please.

    THX.

    secim.xml:


    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout

      xmlns:android="http://schemas.android.com/apk/res/android";
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" >



            <Spinner
                android:prompt="@string/secim_kutusu"
                android:layout_width="wrap_content"
                android:id="@+id/spinner1"
                android:layout_height="wrap_content">

            </Spinner>

            <Button
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="Button"
             android:id="@+id/btn_AddPizza"></Button>

               <LinearLayout
             android:id="@+id/linearLayout2"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent">
              <ScrollView
                  android:id="@+id/sv_PizzaList"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent" >
              </ScrollView>
              </LinearLayout>



    </LinearLayout>


    MyOnclick Event:


                @Override
                public void onClick(View v) {


                         ScrollView sv = (ScrollView) 
findViewById(R.id.sv_PizzaList);

                        //ResimEkle extends Button
                        ResimEkle btnResimEkle = new 
ResimEkle(getApplicationContext
());

                        btnResimEkle.setText("new button");

                        sv.addView(btnResimEkle);


                }

-- 
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

Reply via email to