Android.Dialog.DroidResources.LoadStringEntryLayout C# (CSharp) Method

LoadStringEntryLayout() public static method

public static LoadStringEntryLayout ( Android.Content.Context context, Android.Views.View convertView, Android.Views.ViewGroup parent, int layoutId, Android.Widget.TextView &label, EditText &value ) : Android.Views.View
context Android.Content.Context
convertView Android.Views.View
parent Android.Views.ViewGroup
layoutId int
label Android.Widget.TextView
value EditText
return Android.Views.View
        public static View LoadStringEntryLayout(Context context, View convertView, ViewGroup parent, int layoutId, out TextView label, out EditText value)
        {
            var layout = convertView ?? LoadLayout(context, parent, layoutId);
            if (layout != null)
            {
                label = layout.FindViewById<TextView>(Resource.Id.dialog_LabelField);
                value = layout.FindViewById<EditText>(Resource.Id.dialog_ValueField);
            }
            else
            {
                Log.Error("Android.Dialog", "LoadStringEntryLayout: Failed to load resource: " + layoutId.ToString(CultureInfo.InvariantCulture));
                label = null;
                value = null;
            }
            return layout;
        }

Usage Example

Beispiel #1
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            TextView label;
            var      view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutId, out label, out _entry);

            if (view != null)
            {
                // Warning! Crazy ass hack ahead!
                // since we can't know when out convertedView was was swapped from inside us, we store the
                // old textwatcher in the tag element so it can be removed!!!! (barf, rech, yucky!)
                if (_entry.Tag != null)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                }

                _entry.Text = this.Value;
                _entry.Hint = this.Hint;
                //_entry.EditorAction += new EventHandler<TextView.EditorActionEventArgs>(_entry_EditorAction);
                _entry.ImeOptions = ImeAction.Unspecified;

                if (this.Password)
                {
                    _entry.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword;
                }
                else if (this.Numeric)
                {
                    _entry.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned;
                }
                else
                {
                    _entry.InputType = InputTypes.ClassText;
                }

                if (Lines > 1)
                {
                    _entry.InputType |= InputTypes.TextFlagMultiLine;
                    _entry.SetLines(Lines);
                }
                else if (Send != null)
                {
                    _entry.ImeOptions = ImeAction.Go;
                    _entry.SetImeActionLabel("Go", ImeAction.Go);
                    _entry.EditorAction += new EventHandler <TextView.EditorActionEventArgs>(_entry_EditorAction);
                }

                // continuation of crazy ass hack, stash away the listener value so we can look it up later
                _entry.Tag = this;
                _entry.AddTextChangedListener(this);
                if (label == null)
                {
                    _entry.Hint = Caption;
                }
                else
                {
                    label.Text = Caption;
                }
            }

            return(view);
        }
All Usage Examples Of Android.Dialog.DroidResources::LoadStringEntryLayout