android.widget.RadioGroup.addView C# (CSharp) Method

addView() public method

public addView ( android arg0, int arg1, android arg2 ) : void
arg0 android
arg1 int
arg2 android
return void
        public override void addView(android.view.View arg0, int arg1, android.view.ViewGroup.LayoutParams arg2)
        {
            global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.RadioGroup.staticClass, "addView", "(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V", ref global::android.widget.RadioGroup._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
        }

Usage Example

        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/

            base.onCreate(savedInstanceState);

            ScrollView sv = new ScrollView(this);

            LinearLayout ll = new LinearLayout(this);

            MainView = ll;

            ll.setOrientation(LinearLayout.VERTICAL);

            sv.addView(ll);

            //// http://stackoverflow.com/questions/9784570/webview-inside-scrollview-disappears-after-zooming
            //// http://stackoverflow.com/questions/8123804/unable-to-add-web-view-dynamically
            //// http://developer.android.com/reference/android/webkit/WebView.html



            TextView title = new TextView(this);
            title.setText("JSC Shopping Cart 2");
            ll.addView(title);

            TextView namelabel1 = new TextView(this);
            namelabel1.setText("First Name:");
            ll.addView(namelabel1);


            EditText nameET = new EditText(this);
            nameET.setText("");
            ll.addView(nameET);


            TextView lastnamelabel1 = new TextView(this);
            lastnamelabel1.setText("Last Name:");
            ll.addView(lastnamelabel1);


            EditText lastnameET = new EditText(this);
            lastnameET.setText("");
            ll.addView(lastnameET);


            TextView pkglabel1 = new TextView(this);
            pkglabel1.setText("Select Package:");
            //ll.addView(pkglabel1);

            RadioButton personalRb = new RadioButton(this);
            personalRb.setText("Personal License ($200)");
            //personalRb.AttachTo(ll);

            RadioButton enterpriseRb = new RadioButton(this);
            enterpriseRb.setText("Enterprise License ($400)");
            //enterpriseRb.AttachTo(ll);

            RadioButton commercialRb = new RadioButton(this);
            commercialRb.setText("Commercial License ($600)");
            //commercialRb.AttachTo(ll);

            RadioGroup groupRb = new RadioGroup(this);
            groupRb.addView(personalRb);
            groupRb.addView(enterpriseRb);
            groupRb.addView(commercialRb);
            groupRb.AttachTo(ll);

            Button submitBtn = new Button(this);
            submitBtn.setText("Submit");
            submitBtn.setOnClickListener(new Listener(ll));
            ll.addView(submitBtn);

            this.setContentView(sv);

            this.ShowLongToast("http://jsc-solutions.net");


        }