Ejemplo n.º 1
0
        private void Initialize(IAttributeSet attrs)
        {
            _adapter = new ListItemAdapter(Context, Resource.Layout.SpinnerTextWithImage, Resource.Id.labelSpinner,
                                           new List <ListItemData>());
            _adapter.SetDropDownViewResource(Resource.Layout.SpinnerTextWithImage);

            if (attrs != null)
            {
                var att = Context.ObtainStyledAttributes(attrs, new int[] { Android.Resource.Attribute.Background }, 0, 0);
                _initialBackgroundColor = att.GetColor(0, -1);
            }

            ApplyCustomAttributes(Context, attrs);
        }
Ejemplo n.º 2
0
        private void Initialize(IAttributeSet attrs)
        {
            _adapter = new ListItemAdapter(Context, Resource.Layout.SpinnerTextWithImage, Resource.Id.labelSpinner,
                                           new List <ListItemData>());
            _adapter.SetDropDownViewResource(Resource.Layout.SpinnerTextWithImage);

            if (attrs != null)
            {
                var att = Context.ObtainStyledAttributes(attrs, new int[] { Android.Resource.Attribute.Background }, 0, 0);
                _initialBackgroundColor = att.GetColor(0, -1);

                var attOther = Context.ObtainStyledAttributes(attrs, new int[] { Resource.Attribute.allowOtherSelection }, 0, 0);
                _allowOther = attOther.GetBoolean(0, false);
            }

            _otherItem = new ListItemData
            {
                Key   = Int32.MaxValue,
                Value = this.Services().Localize["OtherListItemLabel"]
            };
        }