protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_autocomplete); // Highlight sample XuniAutoCompleteTextView highLightAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_highlight); //highLightAutoComplete.SetItemsSource(DropDownItem.country); highLightAutoComplete.DisplayMemberPath = "Name"; highLightAutoComplete.ItemsSource = DropDownItem.getList(); highLightAutoComplete.MatchType = MatchType.Contains; highLightAutoComplete.Threshold = 1; // Delay sample XuniAutoCompleteTextView delayAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_delay); delayAutoComplete.DisplayMemberPath = "Name"; delayAutoComplete.ItemsSource = DropDownItem.getList(); delayAutoComplete.MatchType = MatchType.Contains; delayAutoComplete.Threshold = 1; delayAutoComplete.Delay = 1500; // Delay 1500 milliseconds. delayAutoComplete.SetWidth(20); // Custom sample System.Collections.Generic.IDictionary <Integer, string> viewToDataMap = new JavaDictionary <Integer, string>(); viewToDataMap.Add(Integer.ValueOf(Resource.Id.imageView1), "flag"); viewToDataMap.Add(Integer.ValueOf(Resource.Id.textView1), "Name"); XuniAutoCompleteTextView customAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_custom); customAutoComplete.SetDropDownItemLayoutId(Resource.Layout.custom_item); // Custom drop down item. customAutoComplete.SetDropDownItemTextViewId(Resource.Id.textView1); customAutoComplete.ViewDataBinderMap = viewToDataMap; IList <object> list = DropDownItem.getList(); customAutoComplete.ItemsSource = list; customAutoComplete.DisplayMemberPath = "Name"; customAutoComplete.MatchType = MatchType.Contains; customAutoComplete.Threshold = 1; // custom filter sample filterAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_filter); filterAutoComplete.ItemsSource = DropDownItem.getList(); filterAutoComplete.DisplayMemberPath = "Name"; filterAutoComplete.Threshold = 1; filterAutoComplete.FilteringEvent += filterAutoComplete_FilteringEvent; }
//AutoCompleteTextView autoCompleteTextView; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); LinearLayout layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; TextView editableLabel = new TextView(this); editableLabel.SetText(Resource.String.editable); editableLabel.SetTextSize(ComplexUnitType.Sp, 18); layout.AddView(editableLabel); XuniComboBox comboBox = new XuniComboBox(this); comboBox.DisplayMemberPath = "Name"; comboBox.ItemsSource = DropDownItem.getList(); comboBox.SelectedBackgroundColor = Color.Green.ToArgb(); layout.AddView(comboBox); Space emptySpace = new Space(this); layout.AddView(emptySpace); TextView nonEditableLabel = new TextView(this); nonEditableLabel.SetText(Resource.String.noneditable); nonEditableLabel.SetTextSize(ComplexUnitType.Sp, 18); layout.AddView(nonEditableLabel); XuniComboBox nonEditableComboBox = new XuniComboBox(this); nonEditableComboBox.ItemsSource = DropDownItem.getList();; nonEditableComboBox.DisplayMemberPath = "Name"; nonEditableComboBox.SelectedBackgroundColor = Color.Green.ToArgb(); nonEditableComboBox.Editable = false; layout.AddView(nonEditableComboBox); this.SetContentView(layout); }