Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add different kind of widgets based on array size to existing layout

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 352
    Answer it

    How to add different kind of widgets based on array size to existing layout (IN existing layout have some static widgets).

    MY Requirement is based on API response in the JSON array they will define the type (wheter it is check box, dropdown, edittext etc.) so we have to use that API response and add the widgets to existing layout .

    My activity is Sherlock fragment Activity

    Please help me and provide the solution to solve this

 1 Answer(s)

  • Hi

    You need to create a LinearLayout with orientation set as VERTICAL and then add different widget using addView() method of View Class.

    LinearLayout linearLayout=new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(new CheckBox(this)); linearLayout.addView(new TextView(this));

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: