private LinearLayout GetView(Android.Content.Context con) { //mainLayout LinearLayout mainLayout = new LinearLayout(con); mainLayout.SetPadding(20, 20, 20, 30); mainLayout.SetBackgroundColor(Color.Rgb(236, 236, 236)); mainLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mainLayout.Orientation = Orientation.Vertical; mainLayout.AddView(jobSearchLabel); mainLayout.AddView(jobSearchLabelSpacing); mainLayout.AddView(countryLabel); mainLayout.AddView(countryLabelSpacing); mainLayout.AddView(countryNameAutoComplete); mainLayout.AddView(countryAutoCompleteSpacing); mainLayout.AddView(jobFieldLabel); mainLayout.AddView(jobFieldLabelSpacing); mainLayout.AddView(jobFieldAutoComplete); mainLayout.AddView(jobFieldAutoCompleteSpacing); mainLayout.AddView(experienceLabel); mainLayout.AddView(experienceLabelSpacing); mainLayout.AddView(experienceSpinner); mainLayout.AddView(experienceSpinnerSpacing); mainLayout.AddView(searchButtonSpacing); mainLayout.AddView(searchButton); mainLayout.Touch += (object sender, View.TouchEventArgs e) => { Rect outRect = new Rect(); countryNameAutoComplete.GetGlobalVisibleRect(outRect); jobFieldAutoComplete.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { countryNameAutoComplete.ClearFocus(); jobFieldAutoComplete.ClearFocus(); } hideSoftKeyboard((Activity)con); }; return(mainLayout); }
private void MainLayout() { ArrayAdapter <String> experienceAdapter = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleListItem1, Experience); experienceSpinner.Adapter = experienceAdapter; experienceSpinner.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, con.Resources.GetDimensionPixelSize(Resource.Dimension.auto_picker_ht)); //mainLayout LinearLayout mainLayout = new LinearLayout(con); mainLayout.SetPadding(20, 20, 20, 30); mainLayout.SetBackgroundColor(Color.White); mainLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal); mainLayout.Orientation = Orientation.Vertical; mainLayout.AddView(jobSearchLabel); mainLayout.AddView(jobSearchLabelSpacing); mainLayout.AddView(countryLabel); mainLayout.AddView(countryLabelSpacing); mainLayout.AddView(countryNameAutoComplete); mainLayout.AddView(countryAutoCompleteSpacing); mainLayout.AddView(jobFieldLabel); mainLayout.AddView(jobFieldLabelSpacing); mainLayout.AddView(jobFieldAutoComplete); mainLayout.AddView(jobFieldAutoCompleteSpacing); mainLayout.AddView(experienceLabel); mainLayout.AddView(experienceLabelSpacing); mainLayout.AddView(experienceSpinner); mainLayout.AddView(experienceSpinnerSpacing); mainLayout.AddView(searchButtonSpacing); mainLayout.AddView(searchButton); mainLayout.Touch += (object sender, View.TouchEventArgs e) => { if (countryNameAutoComplete.IsFocused || jobFieldAutoComplete.IsFocused) { Rect outRect = new Rect(); countryNameAutoComplete.GetGlobalVisibleRect(outRect); jobFieldAutoComplete.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { countryNameAutoComplete.ClearFocus(); jobFieldAutoComplete.ClearFocus(); } } hideSoftKeyboard((Activity)con); }; frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); frame.SetBackgroundColor(Color.White); frame.SetPadding(10, 10, 10, 10); //scrollView1 ScrollView scrollView1 = new ScrollView(con); scrollView1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal); scrollView1.AddView(mainLayout); frame.AddView(scrollView1); //buttomButtonLayout buttomButtonLayout = new FrameLayout(con); buttomButtonLayout.SetBackgroundColor(Color.Transparent); buttomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal); //propertyButton propertyButton = new Button(con); propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal); propertyButton.Text = "OPTIONS"; propertyButton.Gravity = GravityFlags.Start; propertyFrameLayout = new FrameLayout(con); propertyFrameLayout.SetBackgroundColor(Color.Rgb(236, 236, 236)); propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.CenterHorizontal); propertyFrameLayout.AddView(GetPropertyLayout(con)); //propertyButton Click Listener propertyButton.Click += (object sender, EventArgs e) => { buttomButtonLayout.RemoveAllViews(); propertyFrameLayout.RemoveAllViews(); countryNameAutoComplete.ClearFocus(); jobFieldAutoComplete.ClearFocus(); scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal); propertyFrameLayout.AddView(GetPropertyLayout(con)); }; //scrollView scrollView = new ScrollView(con); scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal); scrollView.AddView(propertyFrameLayout); frame.AddView(scrollView); frame.AddView(buttomButtonLayout); frame.FocusableInTouchMode = true; }
public override View GetSampleContent(Android.Content.Context con) { dlgAlert = new AlertDialog.Builder(con); dlgAlert.SetTitle("Results"); dlgAlert.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) => { }); dlgAlert.SetCancelable(true); Title.Add("Software"); Title.Add("Banking"); Title.Add("Media"); Title.Add("Medical"); spinners = new Spinner(con); spinners.DropDownWidth = 500; spinners.SetBackgroundColor(Color.Gray); ArrayAdapter <String> dataAdapter = new ArrayAdapter <String> (con, Android.Resource.Layout.SimpleSpinnerItem, Experience); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinners.Adapter = dataAdapter; Country.Add("UAE"); Country.Add("Uruguay"); Country.Add("United States"); Country.Add("United Kingdom"); Country.Add("Ukraine"); Experience.Add("1"); Experience.Add("2"); autoComplete1 = new SfAutoComplete(con); autoComplete2 = new SfAutoComplete(con); text1s = new TextView(con); text2s = new TextView(con); text3s = new TextView(con); text4s = new TextView(con); text6s = new TextView(con); text11 = new TextView(con); text22 = new TextView(con); text33 = new TextView(con); text44 = new TextView(con); text55 = new TextView(con); text66 = new TextView(con); text77 = new TextView(con); text88 = new TextView(con); buttons = new Button(con); buttons.SetWidth(ActionBar.LayoutParams.MatchParent); buttons.SetHeight(40); buttons.Text = "Search"; buttons.SetTextColor(Color.White); buttons.SetBackgroundColor(Color.Gray); buttons.Click += (object sender, EventArgs e) => { GetResult(); //dlgAlert.SetMessage(count + " Jobs Found"); dlgAlert.SetMessage(cc + " Jobs Found"); dlgAlert.Create().Show(); }; text11.SetHeight(10); text22.SetHeight(30); text33.SetHeight(10); text44.SetHeight(30); text55.SetHeight(10); text66.SetHeight(30); text77.SetHeight(10); text88.SetHeight(30); text1s.Text = "Job Search"; text1s.TextSize = 30; text1s.Typeface = Typeface.DefaultBold; text2s.Text = "Country"; text2s.TextSize = 16; text3s.Text = "Job Field"; text3s.TextSize = 16; text4s.Text = "Experience"; text4s.TextSize = 16; text6s.SetHeight(40); ArrayAdapter <String> adapters = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleListItem1, new Countrylist().Country); autoComplete1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); autoComplete1.SetAutoCompleteSource(adapters); autoComplete1.SuggestionMode = SuggestionMode.StartsWith; autoComplete1.MaximumDropDownHeight = 200; autoComplete1.Watermark = "Enter a country name"; ArrayAdapter <String> adapters1 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleListItem1, Title); autoComplete2.SetAutoCompleteSource(adapters1); autoComplete2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); autoComplete2.SuggestionMode = SuggestionMode.Contains; autoComplete2.MaximumDropDownHeight = 200; autoComplete2.Watermark = "Starts with ’S’, ‘M’ or ‘B’"; ArrayAdapter <String> adapters2 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleListItem1, Experience); spinners.Adapter = adapters2; spinners.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); LinearLayout linearLayout = new LinearLayout(con); linearLayout.SetPadding(20, 20, 20, 30); linearLayout.SetBackgroundColor(Color.Rgb(236, 236, 236)); linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linearLayout.Orientation = Orientation.Vertical; linearLayout.AddView(text1s); linearLayout.AddView(text6s); linearLayout.AddView(text2s); linearLayout.AddView(text11); linearLayout.AddView(autoComplete1); linearLayout.AddView(text22); linearLayout.AddView(text3s); linearLayout.AddView(text33); linearLayout.AddView(autoComplete2); linearLayout.AddView(text44); linearLayout.AddView(text4s); linearLayout.AddView(text55); linearLayout.AddView(spinners); linearLayout.AddView(text66); linearLayout.AddView(text88); linearLayout.AddView(buttons); linearLayout.Touch += (object sender, View.TouchEventArgs e) => { //if(autoComplete1.IsFocused || autoComplete2.IsFocused ){ Rect outRect = new Rect(); autoComplete1.GetGlobalVisibleRect(outRect); autoComplete2.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { autoComplete1.ClearFocus(); autoComplete2.ClearFocus(); } hideSoftKeyboard((Activity)con); //} }; return(linearLayout); }
public override View GetSampleContent (Android.Content.Context con) { dlgAlert = new AlertDialog.Builder(con); dlgAlert.SetTitle("Results"); dlgAlert.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) => { }); dlgAlert.SetCancelable(true); Title.Add ("Software"); Title.Add ("Banking"); Title.Add ("Media"); Title.Add ("Medical"); spinners = new Spinner(con); spinners.DropDownWidth = 500; spinners.SetBackgroundColor(Color.Gray); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String> (con, Android.Resource.Layout.SimpleSpinnerItem, Experience); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinners.Adapter = dataAdapter; Country.Add ("UAE"); Country.Add ("Uruguay"); Country.Add ("United States"); Country.Add ("United Kingdom"); Country.Add ("Ukraine"); Experience.Add ("1"); Experience.Add ("2"); autoComplete1 = new SfAutoComplete(con); autoComplete2 = new SfAutoComplete(con); text1s = new TextView(con); text2s = new TextView(con); text3s = new TextView(con); text4s = new TextView(con); text6s = new TextView(con); text11 = new TextView(con); text22 = new TextView(con); text33 = new TextView(con); text44 = new TextView(con); text55 = new TextView(con); text66 = new TextView(con); text77 = new TextView(con); text88 = new TextView(con); buttons = new Button(con); buttons.SetWidth(ActionBar.LayoutParams.MatchParent); buttons.SetHeight(40); buttons.Text = "Search"; buttons.SetTextColor(Color.White); buttons.SetBackgroundColor(Color.Gray); buttons.Click += (object sender, EventArgs e) => { GetResult(); //dlgAlert.SetMessage(count + " Jobs Found"); dlgAlert.SetMessage (cc + " Jobs Found"); dlgAlert.Create ().Show (); }; text11.SetHeight(10); text22.SetHeight(30); text33.SetHeight(10); text44.SetHeight(30); text55.SetHeight(10); text66.SetHeight(30); text77.SetHeight(10); text88.SetHeight(30); text1s.Text = "Job Search"; text1s.TextSize = 30; text1s.Typeface = Typeface.DefaultBold; text2s.Text = "Country"; text2s.TextSize = 16; text3s.Text = "Job Field"; text3s.TextSize = 16; text4s.Text = "Experience"; text4s.TextSize = 16; text6s.SetHeight(40); ArrayAdapter<String> adapters = new ArrayAdapter<String>(con, Android.Resource.Layout.SimpleListItem1, new Countrylist().Country); autoComplete1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); autoComplete1.SetAutoCompleteSource(adapters); autoComplete1.SuggestionMode = SuggestionMode.StartsWith; autoComplete1.MaximumDropDownHeight = 200; autoComplete1.Watermark = "Enter a country name"; ArrayAdapter<String> adapters1 = new ArrayAdapter<String>(con, Android.Resource.Layout.SimpleListItem1, Title); autoComplete2.SetAutoCompleteSource(adapters1); autoComplete2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); autoComplete2.SuggestionMode = SuggestionMode.Contains; autoComplete2.MaximumDropDownHeight = 200; autoComplete2.Watermark = "Starts with ’S’, ‘M’ or ‘B’"; ArrayAdapter<String> adapters2 = new ArrayAdapter<String>(con, Android.Resource.Layout.SimpleListItem1, Experience); spinners.Adapter = adapters2; spinners.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60); LinearLayout linearLayout = new LinearLayout(con); linearLayout.SetPadding(20, 20, 20, 30); linearLayout.SetBackgroundColor(Color.Rgb(236, 236, 236)); linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linearLayout.Orientation = Orientation.Vertical; linearLayout.AddView(text1s); linearLayout.AddView(text6s); linearLayout.AddView(text2s); linearLayout.AddView(text11); linearLayout.AddView(autoComplete1); linearLayout.AddView(text22); linearLayout.AddView(text3s); linearLayout.AddView(text33); linearLayout.AddView(autoComplete2); linearLayout.AddView(text44); linearLayout.AddView(text4s); linearLayout.AddView(text55); linearLayout.AddView(spinners); linearLayout.AddView(text66); linearLayout.AddView(text88); linearLayout.AddView(buttons); linearLayout.Touch+= (object sender, View.TouchEventArgs e) => { //if(autoComplete1.IsFocused || autoComplete2.IsFocused ){ Rect outRect = new Rect(); autoComplete1.GetGlobalVisibleRect(outRect); autoComplete2.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { autoComplete1.ClearFocus(); autoComplete2.ClearFocus(); } hideSoftKeyboard((Activity)con); //} }; return linearLayout; }