view and subview

by Jags » Sat, 17 Jul 2010 20:47:05 GMT

Sponsored Links
 is there a way i can create a view and add some textviews into it ?
programmatically ? any sample code ?



view and subview

by grace » Mon, 19 Jul 2010 14:28:52 GMT

 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. */


    public void onCreate(Bundle savedInstanceState) {


        ScrollView sv = new ScrollView(this);

        LinearLayout ll = new LinearLayout(this);



        TextView tv = new TextView(this);

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


        EditText et = new EditText(this);



        Button b = new Button(this);

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


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

                CheckBox cb = new CheckBox(this);

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







Sponsored Links

Other Threads

1. Fwd: how to make center image bigger than rest images , in gallery

---------- Forwarded message ----------
From: Babita kumari <>
Date: Tue, Oct 12, 2010 at 10:55 AM
Subject: how to make center image bigger than rest images , in gallery

I am designing a screen , in which I am showing a gallery along with other
UI components . The selected item of the gallery comes in its center . I
want to make the selected item size somewhat bigger than the rest items of
gallery . How I can do that  .

Please reply . Its  very urgent.....



2. Stack trace Exception

Hello frenz,
   i have written an application in eclipse to run on android emulator
but the application is not deploying  on emulator and it says Failed
to load properties file for project helloworld.
in the error report it says An exception for stack trace is not
I am not able to understand what to do as i am new to android.
Please help me  to find d sol for this problem.


3. error - ANR in com.sent.mail (com.sent.mail/.SentMail) with keyDispatchingTimedOut

4. using long touch to set a seekbar

5. getdeviceid() causing invocation target exception

6. Proxy related code changes needed in Apps

7. Dell Streak