Created
November 11, 2016 23:52
-
-
Save ajpinedam/0be018915e3fd837d54d82c8da61f88f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Button addTextBoxButton; | |
| LinearLayout textBoxHolder; | |
| List<EditText> _myEditTexts; | |
| protected override void OnCreate (Bundle savedInstanceState) | |
| { | |
| base.OnCreate (savedInstanceState); | |
| // Set our view from the "main" layout resource | |
| SetContentView (Resource.Layout.Main); | |
| addTextBoxButton = FindViewById<Button> (Resource.Id.addTextBoxButton); | |
| textBoxHolder = FindViewById<LinearLayout> (Resource.Id.textBoxLayoutHolder); | |
| addTextBoxButton.Click += AddTextBoxButton_Click; | |
| _myEditTexts = new List<EditText> (); | |
| } | |
| void AddTextBoxButton_Click (object sender, System.EventArgs e) | |
| { | |
| var indice = _myEditTexts.Count + 1; | |
| var editText = new EditText (this); | |
| editText.Tag = $"una-forma-de-luego-identificarlos-{indice}"; | |
| var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); | |
| layoutParams.BottomMargin = 6; | |
| editText.LayoutParameters = layoutParams; | |
| editText.Hint = $"Introduzca Texto # {indice}"; | |
| //Solo si quieres guardar referencia de ellos para luego tomar su valor. | |
| _myEditTexts.Add (editText); | |
| textBoxHolder.AddView (editText); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment