hi please check out the sample code for creating views and viewGroups
without a xml


public class tut3 extends Activity {

    /** Called when the activity is first created. */

    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);



        ScrollView sv = new ScrollView(this);

        LinearLayout ll = new LinearLayout(this);

        ll.setOrientation(LinearLayout.VERTICAL);

        sv.addView(ll);



        TextView tv = new TextView(this);

        tv.setText("Dynamic layouts ftw!");

        ll.addView(tv);



        EditText et = new EditText(this);

        et.setText("weeeeeeeeeee~!");

        ll.addView(et);



        Button b = new Button(this);

        b.setText("I don't do anything, but I was added
dynamically. :)");

        ll.addView(b);



        for(int i = 0; i < 20; i++) {

                CheckBox cb = new CheckBox(this);

                cb.setText("I'm dynamic!");

                ll.addView(cb);

        }

        this.setContentView(sv);

    }

}


On Jul 17, 5:46 pm, Jags <jag...@gmail.com> wrote:
> is there a way i can create a view and add some textviews into it ?
> programmatically ? any sample code ?
>
> regards

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