コード例 #1
0
        void BuildAddStudentScreen()
        {
            //Defining the parent layout
            OverAllAddStudentLayout             = (LinearLayout)FindViewById(Resource.Id.AddStudentl);
            OverAllAddStudentLayout.Orientation = Orientation.Vertical;
            OverAllAddStudentLayout.SetGravity(GravityFlags.CenterHorizontal);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining the Label AddStudent Layout
            LabelAddStudentLayout = new LinearLayout(this);
            LabelAddStudentLayout.LayoutParameters = WrapContParams;
            LabelAddStudentLayout.Orientation      = Orientation.Vertical;
            LabelAddStudentLayout.SetGravity(Android.Views.GravityFlags.Center);
            //Defining the Label AddStudent TextView
            LabelAddStudentTV = new TextView(this);
            LabelAddStudentTV.LayoutParameters = WrapContParams;
            LabelAddStudentTV.Text             = "New Student";
            LabelAddStudentTV.TextSize         = 60;
            LabelAddStudentTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            LabelAddStudentTV.SetTextColor(Android.Graphics.Color.DarkRed);
            LabelAddStudentLayout.AddView(LabelAddStudentTV);
            OverAllAddStudentLayout.AddView(LabelAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining the Name AddStudent layout
            NameAddStudentLayout = new LinearLayout(this);
            NameAddStudentLayout.LayoutParameters = WrapContParams;
            NameAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining the Name AddStudent TextView
            NameAddStudentTV = new TextView(this);
            NameAddStudentTV.LayoutParameters = WrapContParams;
            NameAddStudentTV.Text             = "Name: ";
            NameAddStudentTV.TextSize         = 30;
            NameAddStudentTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the Name AddStudent TextInputEditText
            TextInputLayout nameLayout = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            NameAddStudentET = new TextInputEditText(this);
            NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground);
            NameAddStudentET.LayoutParameters         = OneTwentyParams;
            NameAddStudentET.Hint                     = "Full Name";
            NameAddStudentET.TextSize                 = 30;
            NameAddStudentET.FirstBaselineToTopHeight = 10;
            //Adding views to layout
            NameAddStudentLayout.AddView(NameAddStudentTV);
            nameLayout.AddView(NameAddStudentET);
            NameAddStudentLayout.AddView(nameLayout);
            OverAllAddStudentLayout.AddView(NameAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining PhoneNum AddStudent Layout
            PhoneNumAddStudentLayout = new LinearLayout(this);
            PhoneNumAddStudentLayout.LayoutParameters = WrapContParams;
            PhoneNumAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining the PhoneNum AddStudent TextView
            PhoneNumAddStudentTV = new TextView(this);
            PhoneNumAddStudentTV.LayoutParameters = WrapContParams;
            PhoneNumAddStudentTV.Text             = "Phone # ";
            PhoneNumAddStudentTV.TextSize         = 30;
            PhoneNumAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center);
            PhoneNumAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the PhoneNum AddStudent TextInputEditText
            TextInputLayout phone = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            PhoneNumAddStudentET = new TextInputEditText(this);
            PhoneNumAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground);
            PhoneNumAddStudentET.LayoutParameters = OneTwentyParams;
            PhoneNumAddStudentET.Text             = "05";
            PhoneNumAddStudentET.TextSize         = 30;
            PhoneNumAddStudentET.SetSingleLine();
            PhoneNumAddStudentET.InputType = InputTypes.ClassPhone;
            //Adding views to layout
            PhoneNumAddStudentLayout.AddView(PhoneNumAddStudentTV);
            phone.AddView(PhoneNumAddStudentET);
            PhoneNumAddStudentLayout.AddView(phone);
            OverAllAddStudentLayout.AddView(PhoneNumAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            // Defining Email AddStudentLayout
            EmailAddStudentLayout = new LinearLayout(this);
            EmailAddStudentLayout.LayoutParameters = WrapContParams;
            EmailAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining the Email AddStudent TextView
            EmailAddStudentTV = new TextView(this);
            EmailAddStudentTV.LayoutParameters = WrapContParams;
            EmailAddStudentTV.Text             = "Enter Email: ";
            EmailAddStudentTV.TextSize         = 30;
            EmailAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center);
            EmailAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the Email AddStudent TextInputEditText
            TextInputLayout Email = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            EmailAddStudentET = new TextInputEditText(this);
            EmailAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground);
            EmailAddStudentET.LayoutParameters = OneTwentyParams;
            EmailAddStudentET.Hint             = "Email";
            EmailAddStudentET.InputType        = InputTypes.TextVariationEmailAddress;
            EmailAddStudentET.TextSize         = 30;
            EmailAddStudentET.SetSingleLine();
            //Adding views to layout
            EmailAddStudentLayout.AddView(EmailAddStudentTV);
            Email.AddView(EmailAddStudentET);
            EmailAddStudentLayout.AddView(Email);
            OverAllAddStudentLayout.AddView(EmailAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining Parent1NameAddStudentLayout
            Parent1NameAddStudentLayout = new LinearLayout(this);
            Parent1NameAddStudentLayout.LayoutParameters = WrapContParams;
            Parent1NameAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining the Parent1Name AddStudent TextView
            Parent1NameAddStudentTV = new TextView(this);
            Parent1NameAddStudentTV.LayoutParameters = WrapContParams;
            Parent1NameAddStudentTV.Text             = "Parent1 Name: ";
            Parent1NameAddStudentTV.TextSize         = 30;
            Parent1NameAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center);
            Parent1NameAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the Parent1Name AddStudent TextInputEditText
            TextInputLayout p1 = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            Parent1NameAddStudentET = new TextInputEditText(this);
            Parent1NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground);
            Parent1NameAddStudentET.LayoutParameters = OneTwentyParams;
            Parent1NameAddStudentET.Hint             = "Parent1";
            Parent1NameAddStudentET.TextSize         = 30;
            //Adding views to layout
            Parent1NameAddStudentLayout.AddView(Parent1NameAddStudentTV);
            p1.AddView(Parent1NameAddStudentET);
            Parent1NameAddStudentLayout.AddView(p1);
            OverAllAddStudentLayout.AddView(Parent1NameAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining Parent2NameAddStudentLayout
            Parent2NameAddStudentLayout = new LinearLayout(this);
            Parent2NameAddStudentLayout.LayoutParameters = WrapContParams;
            Parent2NameAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining the Parent2Name AddStudent TextView
            Parent2NameAddStudentTV = new TextView(this);
            Parent2NameAddStudentTV.LayoutParameters = WrapContParams;
            Parent2NameAddStudentTV.Text             = "Parent2 Name: ";
            Parent2NameAddStudentTV.TextSize         = 30;
            Parent2NameAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center);
            Parent2NameAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the Parent2Name AddStudent TextInputEditText
            TextInputLayout p2 = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            Parent2NameAddStudentET = new TextInputEditText(this);
            Parent2NameAddStudentET.LayoutParameters = OneTwentyParams;
            Parent2NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground);
            Parent2NameAddStudentET.Hint     = "Parent2";
            Parent2NameAddStudentET.TextSize = 30;
            //Adding views to layout
            Parent2NameAddStudentLayout.AddView(Parent2NameAddStudentTV);
            p2.AddView(Parent2NameAddStudentET);
            Parent2NameAddStudentLayout.AddView(p2);
            OverAllAddStudentLayout.AddView(Parent2NameAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining the AddStudent Explenation layout
            AddStudentExplenationLayout = new LinearLayout(this);
            AddStudentExplenationLayout.LayoutParameters = WrapContParams;
            AddStudentExplenationLayout.Orientation      = Orientation.Vertical;
            //Defining the Explenation AddStudent TextView
            AddStudentExplenationTV = new TextView(this);
            AddStudentExplenationTV.LayoutParameters = WrapContParams;
            AddStudentExplenationTV.Text             = "Student Notes: ";
            AddStudentExplenationTV.TextSize         = 30;
            AddStudentExplenationTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Adding views to layout
            AddStudentExplenationLayout.AddView(AddStudentExplenationTV);
            OverAllAddStudentLayout.AddView(AddStudentExplenationLayout);
            //Defining The AddStudent notes ET layout
            AddStudentExplenationETLayout = new LinearLayout(this);
            AddStudentExplenationETLayout.LayoutParameters = new LinearLayout.LayoutParams(1100, 400);
            AddStudentExplenationETLayout.Orientation      = Orientation.Vertical;
            AddStudentExplenationETLayout.SetBackgroundResource(Resource.Drawable.BlackOutLine);
            AddStudentExplenationETLayout.Click += this.AddStudentExplenationETLayout_Click;
            //Defining the Explenation AddStudent TextInputEditText
            AddStudentExplenationET = new TextInputEditText(this);
            AddStudentExplenationET.SetWidth(LinearLayout.LayoutParams.MatchParent);
            AddStudentExplenationET.Hint     = "Notes";
            AddStudentExplenationET.TextSize = 25;
            AddStudentExplenationET.SetTextIsSelectable(true);
            AddStudentExplenationET.InputType = InputTypes.TextFlagMultiLine;
            AddStudentExplenationET.Gravity   = GravityFlags.Top;
            AddStudentExplenationET.SetSingleLine(false);
            AddStudentExplenationET.SetBackgroundColor(Color.Transparent);
            //Adding viwes to overall layout
            AddStudentExplenationETLayout.AddView(AddStudentExplenationET);
            OverAllAddStudentLayout.AddView(AddStudentExplenationETLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Declare Spinner
            spin = new Spinner(this);
            spin.LayoutParameters = OneTwentyParams;
            spin.ItemSelected    += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleSpinnerItem, groups);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spin.Adapter = adapter;
            //Defining Spinner Layout
            SpinnerLayout = new LinearLayout(this);
            SpinnerLayout.LayoutParameters = WrapContParams;
            SpinnerLayout.Orientation      = Orientation.Horizontal;
            //Adding Views
            SpinnerLayout.AddView(spin);
            OverAllAddStudentLayout.AddView(SpinnerLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining AddStudent Button Layout
            ButtonAddStudentLayout = new LinearLayout(this);
            ButtonAddStudentLayout.LayoutParameters = WrapContParams;
            ButtonAddStudentLayout.Orientation      = Orientation.Horizontal;
            //Defining AddStudent Button
            AddStudentButton = new Button(this);
            AddStudentButton.LayoutParameters = WrapContParams;
            AddStudentButton.Text             = "Add Student";
            AddStudentButton.TextSize         = 40;
            AddStudentButton.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            AddStudentButton.Click           += this.AddStudentButton_Click;
            //Adding views
            ButtonAddStudentLayout.AddView(AddStudentButton);
            OverAllAddStudentLayout.AddView(ButtonAddStudentLayout);
            //=======================================================================================================================================
            //=======================================================================================================================================
            //Defining AddStudent Button Layout
            ButtonSendToMainPageLayout = new LinearLayout(this);
            ButtonSendToMainPageLayout.LayoutParameters = WrapContParams;
            ButtonSendToMainPageLayout.Orientation      = Orientation.Horizontal;
            //Defining AddStudent Button
            SendBackToMainButton = new Button(this);
            SendBackToMainButton.LayoutParameters = WrapContParams;
            SendBackToMainButton.Text             = "Send Back To\nMain Page";
            SendBackToMainButton.TextSize         = 40;
            SendBackToMainButton.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            SendBackToMainButton.SetTextColor(Color.DarkRed);
            SendBackToMainButton.Click += this.SendBackToMainButton_Click;
            //Adding views
            ButtonSendToMainPageLayout.AddView(SendBackToMainButton);
            OverAllAddStudentLayout.AddView(ButtonSendToMainPageLayout);
        }
コード例 #2
0
ファイル: AddExerciseActivity.cs プロジェクト: NaVi-Hub/Judo
        public void BuildAddTrainingScreen()
        {
            //OverAll Layout
            AddTrainingOverAllLayout             = (LinearLayout)FindViewById(Resource.Id.AddTrainingL);
            AddTrainingOverAllLayout.Orientation = Orientation.Vertical;
            //-------------------------------------
            //Defining Label Layout
            AddTrainingLabelLayout = new LinearLayout(this);
            AddTrainingLabelLayout.LayoutParameters = WrapContParams;
            AddTrainingLabelLayout.Orientation      = Orientation.Vertical;
            AddTrainingLabelLayout.SetGravity(Android.Views.GravityFlags.Center);
            //Defining the Label AddTraining TextView
            AddTrainingLabelTV = new TextView(this);
            AddTrainingLabelTV.LayoutParameters = WrapContParams;
            AddTrainingLabelTV.Text             = "New Exercise";
            AddTrainingLabelTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            AddTrainingLabelTV.SetTextColor(Android.Graphics.Color.DarkRed);
            AddTrainingLabelTV.TextSize = 60;
            AddTrainingLabelLayout.AddView(AddTrainingLabelTV);
            AddTrainingOverAllLayout.AddView(AddTrainingLabelLayout);
            //Defining the AddTraining Name layout
            AddTrainingNameLayout = new LinearLayout(this);
            AddTrainingNameLayout.LayoutParameters = WrapContParams;
            AddTrainingNameLayout.Orientation      = Orientation.Horizontal;
            //Defining the Name AddTraining TextView
            AddTrainingNameTV = new TextView(this);
            AddTrainingNameTV.LayoutParameters = WrapContParams;
            AddTrainingNameTV.Text             = "Exercise Name: ";
            AddTrainingNameTV.TextSize         = 30;
            AddTrainingNameTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Defining the Name AddTraining TextInputEditText
            TextInputLayout nameLayout = new TextInputLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };

            AddTrainingNameET = new TextInputEditText(this);
            AddTrainingNameET.SetBackgroundResource(Resource.Drawable.MyBackground);
            AddTrainingNameET.LayoutParameters = OneTwentyParams;
            AddTrainingNameET.Hint             = "name";
            AddTrainingNameET.TextSize         = 30;
            //Adding views to layout
            AddTrainingNameLayout.AddView(AddTrainingNameTV);
            nameLayout.AddView(AddTrainingNameET);
            AddTrainingNameLayout.AddView(nameLayout);
            AddTrainingOverAllLayout.AddView(AddTrainingNameLayout);
            //----------------------------------------------------------------------------------
            //----------------------------------------------------------------------------------------
            //Defining the AddTraining Explenation layout
            AddTrainingExplenationLayout = new LinearLayout(this);
            AddTrainingExplenationLayout.LayoutParameters = WrapContParams;
            AddTrainingExplenationLayout.Orientation      = Orientation.Vertical;
            //Defining the Explenation AddTraining TextView
            AddTrainingExplenationTV = new TextView(this);
            AddTrainingExplenationTV.LayoutParameters = WrapContParams;
            AddTrainingExplenationTV.Text             = "Exercise Explenation: ";
            AddTrainingExplenationTV.TextSize         = 30;
            AddTrainingExplenationTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            //Adding views to layout
            AddTrainingExplenationLayout.AddView(AddTrainingExplenationTV);
            AddTrainingOverAllLayout.AddView(AddTrainingExplenationLayout);
            //Defining The AddTraining Explenation ET layout
            AddTrainingExplenationETLayout = new LinearLayout(this);
            AddTrainingExplenationETLayout.LayoutParameters = new LinearLayout.LayoutParams(1100, 800);
            AddTrainingExplenationETLayout.Orientation      = Orientation.Vertical;
            AddTrainingExplenationETLayout.SetBackgroundResource(Resource.Drawable.BlackOutLine);
            AddTrainingExplenationETLayout.Click += this.AddTrainingExplenationETLayout_Click;
            //Defining the Explenation AddTraining TextInputEditText
            AddTrainingExplenationET = new TextInputEditText(this);
            AddTrainingExplenationET.SetBackgroundResource(Resource.Drawable.MyBackground);
            AddTrainingExplenationET.SetWidth(LinearLayout.LayoutParams.MatchParent);
            AddTrainingExplenationET.Hint     = "Explenation";
            AddTrainingExplenationET.TextSize = 25;
            AddTrainingExplenationET.SetTextIsSelectable(true);
            AddTrainingExplenationET.InputType = InputTypes.TextFlagMultiLine;
            AddTrainingExplenationET.Gravity   = GravityFlags.Top;
            AddTrainingExplenationET.SetSingleLine(false);
            AddTrainingExplenationET.SetBackgroundColor(Color.Transparent);

            //Adding viwes to overall layout
            AddTrainingExplenationETLayout.AddView(AddTrainingExplenationET);
            AddTrainingOverAllLayout.AddView(AddTrainingExplenationETLayout);
            //---------------------------------------------------------------------------------------------------------
            //Defining AddTraining Button Layout
            ButtonAddTrainingLayout = new LinearLayout(this);
            ButtonAddTrainingLayout.LayoutParameters = WrapContParams;
            ButtonAddTrainingLayout.Orientation      = Orientation.Horizontal;
            //Defining AddTraining Button
            AddTrainingButton = new Button(this);
            AddTrainingButton.LayoutParameters = WrapContParams;
            AddTrainingButton.Text             = "Register";
            AddTrainingButton.TextSize         = 40;
            AddTrainingButton.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            AddTrainingButton.Click           += this.AddTrainingButton_Click;
            //Adding views
            ButtonAddTrainingLayout.AddView(AddTrainingButton);
            AddTrainingOverAllLayout.AddView(ButtonAddTrainingLayout);
            //Insert Image:

            /*
             *
             *
             *
             *
             *
             *
             *
             */
        }