コード例 #1
0
        private void SuggestionModeLayout()
        {
            /******************
            **SuggestionMode**
            ******************/
            TextView suggestionModeLabel = new TextView(context);

            suggestionModeLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);
            suggestionModeLabel.Text             = "Suggestion Mode";
            suggestionModeLabel.TextSize         = 15;
            suggestionModeLabel.Gravity          = GravityFlags.Left;

            //SuggestionList
            List <String> suggestionModeList = new List <String>();

            suggestionModeList.Add("StartsWith");
            suggestionModeList.Add("StartsWithCaseSensitive");
            suggestionModeList.Add("Contains");
            suggestionModeList.Add("ContainsWithCaseSensitive");
            suggestionModeList.Add("EndsWith");
            suggestionModeList.Add("EndsWithCaseSensitive");
            suggestionModeList.Add("Equals");
            suggestionModeList.Add("EqualsWithCaseSensitive");

            suggestionModeSpinner     = new Spinner(context, SpinnerMode.Dialog);
            suggestionModeDataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, suggestionModeList);
            suggestionModeDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            suggestionModeSpinner.Adapter = suggestionModeDataAdapter;
            suggestionModeSpinner.SetSelection(selectionPosition);
            suggestionModeSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);

            //suggestionModeSpinner ItemSelected Listener
            suggestionModeSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                selectionPosition = e.Position;
                String selectedItem = suggestionModeDataAdapter.GetItem(e.Position);
                if (selectedItem.Equals("StartsWith"))
                {
                    suggestionModes = SuggestionMode.StartsWith;
                }
                else if (selectedItem.Equals("StartsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.StartsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Contains"))
                {
                    suggestionModes = SuggestionMode.Contains;
                }
                else if (selectedItem.Equals("ContainsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
                }
                else if (selectedItem.Equals("EndsWith"))
                {
                    suggestionModes = SuggestionMode.EndsWith;
                }
                else if (selectedItem.Equals("EndsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EndsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Equals"))
                {
                    suggestionModes = SuggestionMode.Equals;
                }
                else if (selectedItem.Equals("EqualsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
                }
                ApplyChanges();
            };

            LinearLayout suggestionModeLayout = new LinearLayout(context);

            suggestionModeLayout.Orientation = Android.Widget.Orientation.Horizontal;
            suggestionModeLayout.AddView(suggestionModeLabel);
            suggestionModeLayout.AddView(suggestionModeSpinner);

            proprtyOptionsLayout.AddView(suggestionModeLayout);
            TextView spaceText2 = new TextView(context);

            spaceText2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 38, GravityFlags.Center);
            proprtyOptionsLayout.AddView(spaceText2);
        }
コード例 #2
0
		public override View GetPropertyWindowLayout (Android.Content.Context context)
		{
			int width = context.Resources.DisplayMetrics.WidthPixels / 2;
			propertylayout = new LinearLayout(context);
			propertylayout.Orientation = Orientation.Vertical;
			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParams.SetMargins(0, 20, 0, 0);
			//SuggestionMode
			TextView textView1 = new TextView(context);
			textView1.Text = "Suggestion Mode";
			textView1.TextSize=20;
			textView1.Gravity  = GravityFlags.Left;
			TextView textview2 = new TextView(context);
			propertylayout.AddView(textview2);
			spinner1 = new Spinner(context);
			//spinner1.Gravity  = GravityFlags.Left;
			propertylayout.AddView(textView1);
			propertylayout.AddView(spinner1);
			List<String> list = new List<String>();
			list.Add("StartsWith");
			list.Add("StartsWithCaseSensitive");
			list.Add("Contains");
			list.Add("ContainsWithCaseSensitive");
			list.Add("EndsWith");
			list.Add("EndsWithCaseSensitive");
			list.Add("Equals");
			list.Add("EqualsWithCaseSensitive");
			//list.add("None");

			dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			spinner1.Adapter = dataAdapter;

			spinner1.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem (e.Position);
				
				if (selectedItem.Equals ("StartsWith")) {
					suggestionModes = SuggestionMode.StartsWith;
									
				} else if (selectedItem.Equals ("StartsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.StartsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Contains")) {
					suggestionModes = SuggestionMode.Contains;
									
				} else if (selectedItem.Equals ("ContainsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("EndsWith")) {
					suggestionModes = SuggestionMode.EndsWith;
										
				} else if (selectedItem.Equals ("EndsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EndsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Equals")) {
					suggestionModes = SuggestionMode.Equals;
										
				} else if (selectedItem.Equals ("EqualsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
										
				}
			};
			//Separator 1
			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParam1 = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParam1.SetMargins(0, 20, 0, 0);
			propertylayout.AddView(separate,layoutParam1);

			//AutoCompleteMode
			TextView textV1 = new TextView(context);
			textV1.Text = "AutoComplete Mode";
			textV1.TextSize=20;
			textV1.Gravity = GravityFlags.Left;
			TextView textv2 = new TextView(context);
			propertylayout.AddView(textv2);
			text3 = new Spinner(context);
			propertylayout.AddView(textV1);
			propertylayout.AddView(text3);
			List<String> list1 = new List<String>();
			list1.Add("Suggest");
			list1.Add("SuggestAppend");
			list1.Add("Append");

			dataadapter1 = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list1);
			dataadapter1.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			text3.Adapter = dataadapter1;

			text3.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataadapter1.GetItem(e.Position);
									if (selectedItem.Equals("Suggest")) {
										autoCompleteMode = AutoCompleteMode.Suggest;
										
									} else if (selectedItem.Equals("SuggestAppend")) {
										autoCompleteMode = AutoCompleteMode.SuggestAppend;
										
									} else if (selectedItem.Equals("Append")) {
										autoCompleteMode = AutoCompleteMode.Append;
										
									}
			};

			//Separator 2
			SeparatorView separate1 = new SeparatorView(context, width * 2);
			separate1.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);

			LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParams2.SetMargins(0, 20, 0, 0);
			propertylayout.SetPadding(15, 0, 15, 0);

			//Separator 2
			SeparatorView separate2 = new SeparatorView(context, width * 2);
			separate2.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			propertylayout.AddView(separate2, layoutParams2);

			//Min Prefix Character
			TextView textView7 = new TextView(context);
			textView7.Text = "Min Prefix Character";
			textView7.SetWidth(400);
			textView7.TextSize=20;
			etext1 = new EditText(context);
			etext1.Text = "1";
			etext1.TextSize=16;
			etext1.InputType = Android.Text.InputTypes.ClassPhone;
			etext1.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext1.Text.Length > 0)
					minimum =  Convert.ToInt32(e.Text.ToString());
				else
					minimum = 1;
			};

			LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams7.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams8.SetMargins(0, 10, 0, 0);
			stackView2 = new LinearLayout(context);
			stackView2.AddView(textView7,layoutParams8);
			stackView2.AddView(etext1, layoutParams7);
			stackView2.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView2);
			SeparatorView separate4 = new SeparatorView(context, width * 2);
			separate4.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams6.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate4, layoutParams6);

			//max DropDown height
			TextView textView8 = new TextView(context);
			textView8.Text = "Max DropDown Height";
			textView8.SetWidth(400);
			textView8.TextSize=20;
			etext2 = new EditText(context);
			etext2.Text = "200";
			etext2.TextSize=16;
			etext2.InputType = Android.Text.InputTypes.ClassPhone;
			etext2.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext2.Text.Length>0)
					maximum =  Convert.ToInt32(e.Text.ToString());
				else
					maximum = 200;
			};

			LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams9.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams10 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams10.SetMargins(0, 10, 0, 0);
			stackView3 = new LinearLayout(context);
			stackView3.AddView(textView8,layoutParams10);
			stackView3.AddView(etext2, layoutParams9);
			stackView3.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView3);
			SeparatorView separate5 = new SeparatorView(context, width * 2);
			separate5.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams11 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams11.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate5, layoutParams11);

			//Popup Delay
			TextView textView9 = new TextView(context);
			textView9.Text = "PopUp Delay";
			textView9.SetWidth(400);
			textView9.TextSize=20;
			etext3 = new EditText(context);
			etext3.Text = "100";
			etext3.TextSize=16;
			etext3.InputType = Android.Text.InputTypes.ClassPhone;
			etext1.SetWidth(50);
			etext2.SetWidth(50);
			etext3.SetWidth(50);

			etext3.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext3.Text.Length>0)
					popupdelay=  Convert.ToInt32(e.Text.ToString());
				else
					popupdelay = 100;
			};
			LinearLayout.LayoutParams layoutParams12 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams12.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams13 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams13.SetMargins(0, 10, 0, 0);
			stackView4 = new LinearLayout(context);
			stackView4.AddView(textView9,layoutParams13);
			stackView4.AddView(etext3, layoutParams12);
			stackView4.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView4);
			SeparatorView separate6 = new SeparatorView(context, width * 2);
			separate6.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams14 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams14.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate6, layoutParams14);

			return propertylayout;

		}
コード例 #3
0
        public override View GetPropertyWindowLayout(Android.Content.Context context)
        {
            int width = context.Resources.DisplayMetrics.WidthPixels / 2;

            propertylayout             = new LinearLayout(context);
            propertylayout.Orientation = Orientation.Vertical;
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                width * 2, 5);
            layoutParams.SetMargins(0, 20, 0, 0);
            //SuggestionMode
            TextView textView1 = new TextView(context);

            textView1.Text     = "Suggestion Mode";
            textView1.TextSize = 20;
            textView1.Gravity  = GravityFlags.Left;
            TextView textview2 = new TextView(context);

            propertylayout.AddView(textview2);
            spinner1 = new Spinner(context);
            //spinner1.Gravity  = GravityFlags.Left;
            propertylayout.AddView(textView1);
            propertylayout.AddView(spinner1);
            List <String> list = new List <String>();

            list.Add("StartsWith");
            list.Add("StartsWithCaseSensitive");
            list.Add("Contains");
            list.Add("ContainsWithCaseSensitive");
            list.Add("EndsWith");
            list.Add("EndsWithCaseSensitive");
            list.Add("Equals");
            list.Add("EqualsWithCaseSensitive");
            //list.add("None");

            dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            spinner1.Adapter = dataAdapter;

            spinner1.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = dataAdapter.GetItem(e.Position);

                if (selectedItem.Equals("StartsWith"))
                {
                    suggestionModes = SuggestionMode.StartsWith;
                }
                else if (selectedItem.Equals("StartsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.StartsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Contains"))
                {
                    suggestionModes = SuggestionMode.Contains;
                }
                else if (selectedItem.Equals("ContainsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
                }
                else if (selectedItem.Equals("EndsWith"))
                {
                    suggestionModes = SuggestionMode.EndsWith;
                }
                else if (selectedItem.Equals("EndsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EndsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Equals"))
                {
                    suggestionModes = SuggestionMode.Equals;
                }
                else if (selectedItem.Equals("EqualsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
                }
            };
            //Separator 1
            SeparatorView separate = new SeparatorView(context, width * 2);

            separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams layoutParam1 = new LinearLayout.LayoutParams(
                width * 2, 5);
            layoutParam1.SetMargins(0, 20, 0, 0);
            propertylayout.AddView(separate, layoutParam1);

            //AutoCompleteMode
            TextView textV1 = new TextView(context);

            textV1.Text     = "AutoComplete Mode";
            textV1.TextSize = 20;
            textV1.Gravity  = GravityFlags.Left;
            TextView textv2 = new TextView(context);

            propertylayout.AddView(textv2);
            text3 = new Spinner(context);
            propertylayout.AddView(textV1);
            propertylayout.AddView(text3);
            List <String> list1 = new List <String>();

            list1.Add("Suggest");
            list1.Add("SuggestAppend");
            list1.Add("Append");

            dataadapter1 = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, list1);
            dataadapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            text3.Adapter = dataadapter1;

            text3.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = dataadapter1.GetItem(e.Position);
                if (selectedItem.Equals("Suggest"))
                {
                    autoCompleteMode = AutoCompleteMode.Suggest;
                }
                else if (selectedItem.Equals("SuggestAppend"))
                {
                    autoCompleteMode = AutoCompleteMode.SuggestAppend;
                }
                else if (selectedItem.Equals("Append"))
                {
                    autoCompleteMode = AutoCompleteMode.Append;
                }
            };

            //Separator 2
            SeparatorView separate1 = new SeparatorView(context, width * 2);

            separate1.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);

            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
                width * 2, 5);
            layoutParams2.SetMargins(0, 20, 0, 0);
            propertylayout.SetPadding(15, 0, 15, 0);

            //Separator 2
            SeparatorView separate2 = new SeparatorView(context, width * 2);

            separate2.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            propertylayout.AddView(separate2, layoutParams2);

            //Min Prefix Character
            TextView textView7 = new TextView(context);

            textView7.Text = "Min Prefix Character";
            textView7.SetWidth(400);
            textView7.TextSize  = 20;
            etext1              = new EditText(context);
            etext1.Text         = "1";
            etext1.TextSize     = 16;
            etext1.InputType    = Android.Text.InputTypes.ClassPhone;
            etext1.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                if (etext1.Text.Length > 0)
                {
                    minimum = Convert.ToInt32(e.Text.ToString());
                }
                else
                {
                    minimum = 1;
                }
            };

            LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            layoutParams7.SetMargins(0, 10, 0, 0);
            LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent, 55);
            layoutParams8.SetMargins(0, 10, 0, 0);
            stackView2 = new LinearLayout(context);
            stackView2.AddView(textView7, layoutParams8);
            stackView2.AddView(etext1, layoutParams7);
            stackView2.Orientation = Orientation.Horizontal;
            propertylayout.AddView(stackView2);
            SeparatorView separate4 = new SeparatorView(context, width * 2);

            separate4.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(width * 2, 5);
            layoutParams6.SetMargins(0, 20, 15, 0);
            propertylayout.AddView(separate4, layoutParams6);

            //max DropDown height
            TextView textView8 = new TextView(context);

            textView8.Text = "Max DropDown Height";
            textView8.SetWidth(400);
            textView8.TextSize  = 20;
            etext2              = new EditText(context);
            etext2.Text         = "200";
            etext2.TextSize     = 16;
            etext2.InputType    = Android.Text.InputTypes.ClassPhone;
            etext2.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                if (etext2.Text.Length > 0)
                {
                    maximum = Convert.ToInt32(e.Text.ToString());
                }
                else
                {
                    maximum = 200;
                }
            };

            LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            layoutParams9.SetMargins(0, 10, 0, 0);
            LinearLayout.LayoutParams layoutParams10 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent, 55);
            layoutParams10.SetMargins(0, 10, 0, 0);
            stackView3 = new LinearLayout(context);
            stackView3.AddView(textView8, layoutParams10);
            stackView3.AddView(etext2, layoutParams9);
            stackView3.Orientation = Orientation.Horizontal;
            propertylayout.AddView(stackView3);
            SeparatorView separate5 = new SeparatorView(context, width * 2);

            separate5.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams layoutParams11 = new LinearLayout.LayoutParams(width * 2, 5);
            layoutParams11.SetMargins(0, 20, 15, 0);
            propertylayout.AddView(separate5, layoutParams11);

            //Popup Delay
            TextView textView9 = new TextView(context);

            textView9.Text = "PopUp Delay";
            textView9.SetWidth(400);
            textView9.TextSize = 20;
            etext3             = new EditText(context);
            etext3.Text        = "100";
            etext3.TextSize    = 16;
            etext3.InputType   = Android.Text.InputTypes.ClassPhone;
            etext1.SetWidth(50);
            etext2.SetWidth(50);
            etext3.SetWidth(50);

            etext3.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                if (etext3.Text.Length > 0)
                {
                    popupdelay = Convert.ToInt32(e.Text.ToString());
                }
                else
                {
                    popupdelay = 100;
                }
            };
            LinearLayout.LayoutParams layoutParams12 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            layoutParams12.SetMargins(0, 10, 0, 0);
            LinearLayout.LayoutParams layoutParams13 = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent, 55);
            layoutParams13.SetMargins(0, 10, 0, 0);
            stackView4 = new LinearLayout(context);
            stackView4.AddView(textView9, layoutParams13);
            stackView4.AddView(etext3, layoutParams12);
            stackView4.Orientation = Orientation.Horizontal;
            propertylayout.AddView(stackView4);
            SeparatorView separate6 = new SeparatorView(context, width * 2);

            separate6.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams layoutParams14 = new LinearLayout.LayoutParams(width * 2, 5);
            layoutParams14.SetMargins(0, 20, 15, 0);
            propertylayout.AddView(separate6, layoutParams14);

            return(propertylayout);
        }
コード例 #4
0
        private void SuggestionModeLayout()
        {
            /*****************
             **SuggestionMode**
             ******************/
            TextView suggestionModeLabel = new TextView(context);

            suggestionModeLabel.Text     = "Suggestion Mode";
            suggestionModeLabel.TextSize = 20;
            suggestionModeLabel.Gravity  = GravityFlags.Left;

            //SpaceText
            TextView spacingText = new TextView(context);

            propertylayout.AddView(spacingText);
            suggestionModeSpinner = new Spinner(context, SpinnerMode.Dialog);
            propertylayout.AddView(suggestionModeLabel);
            propertylayout.AddView(suggestionModeSpinner);

            //SuggestionList
            List <String> suggestionModeList = new List <String>();

            suggestionModeList.Add("StartsWith");
            suggestionModeList.Add("StartsWithCaseSensitive");
            suggestionModeList.Add("Contains");
            suggestionModeList.Add("ContainsWithCaseSensitive");
            suggestionModeList.Add("EndsWith");
            suggestionModeList.Add("EndsWithCaseSensitive");
            suggestionModeList.Add("Equals");
            suggestionModeList.Add("EqualsWithCaseSensitive");
            suggestionModeDataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, suggestionModeList);
            suggestionModeDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            suggestionModeSpinner.Adapter = suggestionModeDataAdapter;

            //suggestionModeSpinner ItemSelected Listener
            suggestionModeSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = suggestionModeDataAdapter.GetItem(e.Position);
                if (selectedItem.Equals("StartsWith"))
                {
                    suggestionModes = SuggestionMode.StartsWith;
                }
                else if (selectedItem.Equals("StartsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.StartsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Contains"))
                {
                    suggestionModes = SuggestionMode.Contains;
                }
                else if (selectedItem.Equals("ContainsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
                }
                else if (selectedItem.Equals("EndsWith"))
                {
                    suggestionModes = SuggestionMode.EndsWith;
                }
                else if (selectedItem.Equals("EndsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EndsWithCaseSensitive;
                }
                else if (selectedItem.Equals("Equals"))
                {
                    suggestionModes = SuggestionMode.Equals;
                }
                else if (selectedItem.Equals("EqualsWithCaseSensitive"))
                {
                    suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
                }
            };

            //Separator
            SeparatorView suggestionModeSeparate = new SeparatorView(context, width * 2);

            suggestionModeSeparate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
            LinearLayout.LayoutParams suggestionModeLayoutParam = new LinearLayout.LayoutParams(width * 2, 5);
            suggestionModeLayoutParam.SetMargins(0, 20, 0, 0);
            // propertylayout.AddView(suggestionModeSeparate, suggestionModeLayoutParam);
        }