当前位置: 首页>>代码示例>>C#>>正文


C# LinearLayout.SetMinimumHeight方法代码示例

本文整理汇总了C#中LinearLayout.SetMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.SetMinimumHeight方法的具体用法?C# LinearLayout.SetMinimumHeight怎么用?C# LinearLayout.SetMinimumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinearLayout的用法示例。


在下文中一共展示了LinearLayout.SetMinimumHeight方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: handleMealInfoLayout

		public void handleMealInfoLayout (LinearLayout mealInfo, int width, int height, 
			LinearLayout.LayoutParams mealInfoLL, int count, JsonValue json) {
			mealInfo.Orientation = Orientation.Horizontal;
			mealInfo.SetMinimumWidth (25);
			mealInfo.SetMinimumHeight (25);
			mealInfoLL.SetMargins (5, 5, 5, 5);
			mealInfo.LayoutParameters = mealInfoLL;
			mealInfo.Id = count * 20 + 7;
		}
开发者ID:aliarobinson,项目名称:SpeedyChef_375,代码行数:9,代码来源:MealPlannerCalendar.cs

示例2: createMessageBar

        private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver)
        {
            LinearLayout icons = new LinearLayout (context);
            icons.Orientation = Orientation.Horizontal;
            icons.SetGravity (GravityFlags.Left);
            icons.SetVerticalGravity (GravityFlags.CenterVertical);
            icons.SetMinimumHeight (30);

            icons.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            if (message.MessageStepDBList.Count == 0) {
                ImageView random1 = new ImageView (context);
                using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                    lp.SetMargins (0, 0, leftOver - (int)ImageHelper.convertDpToPixel (30f, context), 0);
                    random1.LayoutParameters = lp;
                }
                random1.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                random1.SetBackgroundResource (Resource.Drawable.playblack);
                random1.ContentDescription = message.MessageGuid;
                random1.Click += delegate {
                    Messages.MessageReceived m = new Messages.MessageReceived (message, context);
                };
                RunOnUiThread (() => icons.AddView (random1));
            } else {
                int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count;
                int iconSize = (int)ImageHelper.convertDpToPixel (34f, context);
                int toEnd = leftOver - (2 * iconSize) - (end * iconSize);
                for (int i = 0; i < end; ++i) {
                    switch (message.MessageStepDBList [i].StepType) {
                    case LOLMessageDelivery.MessageStep.StepTypes.Text:
                        ImageView random2 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random2.LayoutParameters = lp;
                        }
                        random2.SetBackgroundResource (Resource.Drawable.textmsg);
                        random2.ContentDescription = message.MessageID.ToString ();
                        random2.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random2));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                        ImageView random3 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random3.LayoutParameters = lp;
                        }
                        random3.SetBackgroundResource (Resource.Drawable.drawicon);
                        random3.ContentDescription = message.MessageID.ToString ();
                        random3.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random3));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                        ImageView random4 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random4.LayoutParameters = lp;
                        }
                        random4.SetBackgroundResource (Resource.Drawable.comicon);
                        random4.ContentDescription = message.MessageID.ToString ();
                        random4.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random4));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                        ImageView random5 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random5.LayoutParameters = lp;
                        }
                        random5.SetBackgroundResource (Resource.Drawable.comix);
                        random5.ContentDescription = message.MessageID.ToString ();
                        random5.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random5));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                        ImageView random6 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random6.LayoutParameters = lp;
                        }
                        random6.SetBackgroundResource (Resource.Drawable.emoticon);
                        random6.ContentDescription = message.MessageID.ToString ();
                        random6.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random6));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.Polling:
                        ImageView random7 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random7.LayoutParameters = lp;
                        }
                        random7.SetBackgroundResource (Resource.Drawable.polls);
                        random7.ContentDescription = message.MessageID.ToString ();
                        random7.Click += new EventHandler (imgMessage_Click);
                        RunOnUiThread (() => icons.AddView (random7));
                        break;
                    case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
                        ImageView random8 = new ImageView (context);
                        using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                            lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0);
                            random8.LayoutParameters = lp;
                        }
//.........这里部分代码省略.........
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:ConversationsUI-original.cs

示例3: handleMealObjectCreation

		public void handleMealObjectCreation(LinearLayout mealObject, int width, int height, LinearLayout.LayoutParams mealObjectLL, int count, JsonValue json) {
			mealObject.Orientation = Orientation.Vertical;
			mealObject.SetMinimumWidth (width);
			mealObject.SetMinimumHeight (height);
			mealObject.LayoutParameters = mealObjectLL;
			mealObject.Id = count * 20 + 5;
			mealObject.AddView (CreateButtonContainer (json, count));
		}
开发者ID:aliarobinson,项目名称:SpeedyChef_375,代码行数:8,代码来源:MealPlannerCalendar.cs

示例4: CreatePreviewUI


//.........这里部分代码省略.........
                                            break;
                                        }
                                    }

                                    if (string.IsNullOrEmpty (messager))
                                        messager = "";

                                    int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                    txtMessage.SetHeight (nolines);

                                    txtMessage.SetTextColor (Android.Graphics.Color.Black);
                                    txtMessage.Text = messager;
                                    txtMessage.ContentDescription = eachMessage.Key;
                                    txtMessage.Click += ConversationItem_Clicked;
                                    layout2.AddView (txtMessage);
                                }
                            } else {
                                int text = 0;
                                for (int tt = 0; tt < eachMessage.Value.Message.MessageStepDBList.Count; ++tt) {
                                    if (eachMessage.Value.Message.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
                                        text++;
                                }

                                LinearLayout layout3 = new LinearLayout (context);
                                LinearLayout.LayoutParams layout3params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                                layout3params.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context));
                                layout3.LayoutParameters = layout3params;
                                layout3.Orientation = Orientation.Horizontal;
                                layout3.SetGravity (GravityFlags.Left);
                                layout3.ContentDescription = eachMessage.Key;
                                layout3.Click += ConversationLayItem_Clicked;
                                layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                                layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                                layout3.SetMinimumHeight (30);
                                layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                                int end = eachMessage.Value.Message.MessageStepDBList.Count > 3 ? 3 : eachMessage.Value.Message.MessageStepDBList.Count;
                                for (int i = 0; i < end; ++i) {
                                    switch (eachMessage.Value.Message.MessageStepDBList [i].StepType) {
                                    case LOLMessageDelivery.MessageStep.StepTypes.Text:
                                        if (text == 1) {
                                            using (TextView txtMessage = new TextView (context)) {
                                                using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context),
                                                                                                                        (int)ImageHelper.convertDpToPixel (60f, context))) {
                                                    txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0);
                                                    txtMessage.LayoutParameters = txtMessageParams;
                                                }
                                                txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                                                txtMessage.Gravity = GravityFlags.CenterVertical;

                                                if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID)
                                                    txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                                else
                                                    txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                                txtMessage.TextSize = 16f;

                                                for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) {
                                                    if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) {
                                                        messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText;
                                                        break;
                                                    }
                                                }

                                                if (string.IsNullOrEmpty (messager))
                                                    messager = "No text message found";
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:67,代码来源:MessageReceivedActivityUI.cs

示例5: createUI


//.........这里部分代码省略.........
                                if (name == isMe)
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                else
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                text.TextSize = 16f;

                                for (int e = 0; e < messages.MessageStepDBList.Count; ++e) {
                                    if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) {
                                        messager = messages.MessageStepDBList [e].MessageText;
                                        break;
                                    }
                                }

                                if (string.IsNullOrEmpty (messager))
                                    messager = "No text message found";

                                int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                text.SetHeight (nolines);

                                text.SetTextColor (Android.Graphics.Color.Black);
                                text.Text = messager;
                                layout2.Clickable = true;
                                layout2.AddView (text);
                            } else {*/
                        LinearLayout layout3 = new LinearLayout (context);
                        layout3.Orientation = Orientation.Horizontal;
                        if (name == isMe)
                            layout3.SetGravity (GravityFlags.Right);
                        else
                            layout3.SetGravity (GravityFlags.Left);
                        layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                        layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                        layout3.SetMinimumHeight (30);
                        layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                        if (name != isMe) {
                            using (random = new ImageView (context)) {
                                random.Tag = m;
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                random.ContentDescription = messages.MessageGuid;
                                random.Click += PlayButton_Clicked;

                                layout3.AddView (random);
                            }
                        }

                        int textt = 0;
                        for (int tt = 0; tt < messages.MessageStepDBList.Count; ++tt) {
                            if (messages.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
                                textt++;
                        }

                        for (int i = 0; i < messages.MessageStepDBList.Count; ++i) {
                            switch (messages.MessageStepDBList [i].StepType) {
                            case LOLMessageDelivery.MessageStep.StepTypes.Text:
                                if (textt == 1) {
                                    TextView text = new TextView (context);
                                    text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                                    text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                    text.Gravity = GravityFlags.CenterVertical;
                                    if (name == isMe)
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                    else
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:67,代码来源:MessageReceivedActivityUI.cs

示例6: OnCreate

        //--------------------------------------------------------------
        // EVENT CATCHING METHODS
        //--------------------------------------------------------------
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
            SetContentView(Resource.Layout.Dialog);

            _root = FindViewById<LinearLayout>(Resource.Id.alertContainer);
            _root.SetPadding(Builder.StrokeBorderWidth, Builder.StrokeBorderWidth, Builder.StrokeBorderWidth, Builder.StrokeBorderWidth);
            _root.SetMinimumWidth ((int)(WindowManager.DefaultDisplay.Width * MinWidthRatio));
            _root.SetMinimumHeight((int)(WindowManager.DefaultDisplay.Height * MinHeightRatio));

            if(_root.ViewTreeObserver.IsAlive)
            {
                _root.ViewTreeObserver.AddOnGlobalLayoutListener(this);
            }

            _title = FindViewById<TextView>(Resource.Id.alertTitle);
            _title.SetTextColor(Builder.StrokeColor);
            _title.Gravity = GravityFlags.CenterHorizontal;
            if(String.IsNullOrEmpty(Builder.Title))
            {
                _title.Visibility = ViewStates.Gone;
            }
            else
            {
                _title.Text = Builder.Title;
            }

            _content = FindViewById<LinearLayout>(Resource.Id.alertContent);
            switch (Builder.ContentType)
            {
            case DialogBuilder.DialogContentType.TextView:
                if(!String.IsNullOrEmpty(Builder.Message))
                {
                    _message = new TextView(this);
                    _message.Text = Builder.Message;
                    _message.SetTextSize(Android.Util.ComplexUnitType.Dip, TextSize);
                    _message.SetTextColor(Builder.TextColor);
                    _message.Gravity = GravityFlags.CenterHorizontal;
                    _content.AddView(_message, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                }
                break;
            case DialogBuilder.DialogContentType.EditText:
                _field = new EditText(this);
                _field.Hint = Builder.Message;
                _field.SetTextSize(Android.Util.ComplexUnitType.Dip, TextSize);
                // Limit the length
                _field.SetFilters( new IInputFilter[] { new InputFilterLengthFilter(Constants.MaxLengthName) } );
                _content.AddView(_field, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                break;
            case DialogBuilder.DialogContentType.None:
                foreach(View view in Builder.Content)
                {
                    _content.AddView(view, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                }
                break;
            default:
                break;
            }

            _buttonLayout = FindViewById<LinearLayout>(Resource.Id.buttonLayout);
            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) _buttonLayout.LayoutParameters;
            lp.TopMargin = Builder.StrokeBorderWidth;
            _buttonLayout.LayoutParameters = lp;

            _positiveButton = FindViewById<ButtonStroked>(Resource.Id.positiveButton);
            _negativeButton = FindViewById<ButtonStroked>(Resource.Id.negativeButton);

            if(String.IsNullOrEmpty(Builder.PositiveText) && String.IsNullOrEmpty(Builder.NegativeText))
            {
                _positiveButton.Visibility = ViewStates.Gone;
                _negativeButton.Visibility = ViewStates.Gone;
            }
            else if(String.IsNullOrEmpty(Builder.PositiveText))
            {
                _positiveButton.Visibility = ViewStates.Gone;
                LinearLayout.LayoutParams lpNeg = (LinearLayout.LayoutParams) _negativeButton.LayoutParameters;
                lpNeg.Weight = 2;
                _negativeButton.LayoutParameters = lpNeg;
            }
            else if(String.IsNullOrEmpty(Builder.NegativeText))
            {
                _negativeButton.Visibility = ViewStates.Gone;
                LinearLayout.LayoutParams lpPos = (LinearLayout.LayoutParams) _positiveButton.LayoutParameters;
                lpPos.Weight = 2;
                _positiveButton.LayoutParameters = lpPos;
            }
            else
            {
                LinearLayout.LayoutParams lpPos = (LinearLayout.LayoutParams) _positiveButton.LayoutParameters;
                lpPos.LeftMargin = Builder.StrokeBorderWidth/2;
                _positiveButton.LayoutParameters = lpPos;
                LinearLayout.LayoutParams lpNeg = (LinearLayout.LayoutParams) _negativeButton.LayoutParameters;
                lpNeg.RightMargin = Builder.StrokeBorderWidth/2;
                _negativeButton.LayoutParameters = lpNeg;
//.........这里部分代码省略.........
开发者ID:lea-and-anthony,项目名称:Tetrim,代码行数:101,代码来源:DialogActivity.cs

示例7: AddRowToLayout

        void AddRowToLayout(SearchRow item)
        {
            var row = new LinearLayout(context) { Orientation = Orientation.Horizontal };
            row.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
            row.WeightSum = 1;

            row.SetMinimumHeight(PixelConverter.DpToPixels(30));

            LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 0.5f);
            LinearLayout.LayoutParams f = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            var entryHolder = new LinearLayout(context);
            entryHolder.Orientation = Orientation.Horizontal;
            entryHolder.SetHorizontalGravity(GravityFlags.Right);
            entryHolder.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            entryHolder.ShowDividers = ShowDividers.Middle;
            entryHolder.DividerPadding = 20;
            entryHolder.SetPadding(PixelConverter.DpToPixels(10), 0, 0, 0);

            switch (item.RowType)
            {
                case SearchRowTypes.Heading:
                    row.AddView(Heading(item));

                    break;
                case SearchRowTypes.SearchTerms:
                    EditText searchfield = new EditText(context);
                    searchfield.LayoutParameters = f;
                    searchfield.Hint = string.Format("Search {0}:", this.category.Value);
                    searchfield.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f);
                    searchfield.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));
                    searchfield.SetSingleLine(true);
                    searchfield.InputType = InputTypes.ClassText;
                    row.AddView(searchfield);

                    searchfield.TextChanged += (object sender, TextChangedEventArgs e) =>
                    {
                        AddSearchItem(item.QueryPrefix, e.Text.ToString());
                    };

                    break;
                case SearchRowTypes.PriceDoubleEntry:
                    row.AddView(Title(item));

                    EditText minPricefield = new EditText(context);
                    minPricefield.LayoutParameters = p;
                    minPricefield.Hint = "min";
                    minPricefield.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f);
                    minPricefield.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));
                    minPricefield.SetSingleLine(true);
                    minPricefield.InputType = InputTypes.ClassNumber;
                    entryHolder.AddView(minPricefield);

                    EditText maxPricefield = new EditText(context);
                    maxPricefield.LayoutParameters = p;
                    maxPricefield.Hint = "max";
                    maxPricefield.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f);
                    maxPricefield.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));
                    maxPricefield.SetSingleLine(true);
                    maxPricefield.InputType = InputTypes.ClassNumber;
                    entryHolder.AddView(maxPricefield);

                    minPricefield.TextChanged += (object sender, TextChangedEventArgs e) =>
                    {
                        //TODO: Get this text masking to work correctly
                        //string text = minPricefield.Text;
                        //if (text.Length > 0 && text.Substring(0, 1) == "$")
                        //    minPricefield.Text = text;
                        //else
                        //    minPricefield.Text = "$" + text;

                        AddSearchItem(item.QueryPrefix, e.Text.ToString());
                    };

                    maxPricefield.TextChanged += (object sender, TextChangedEventArgs e) =>
                    {
                        //string text = maxPricefield.Text;
                        //if (text.Length > 0 && text.Substring(0, 1) == "$")
                        //    maxPricefield.SetText(text, null);
                        //else
                        //    maxPricefield.Text = "$" + text;

                        AddSearchItem(item.SecondQueryPrefix, e.Text.ToString());
                    };

                    row.AddView(entryHolder);
                    break;

                case SearchRowTypes.DoubleEntry:
                    row.AddView(Title(item));

                    EditText minfield = new EditText(context);
                    minfield.LayoutParameters = p;

                    minfield.Hint = "min";
                    minfield.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f);
                    minfield.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));
                    minfield.SetSingleLine(true);
                    minfield.InputType = InputTypes.ClassNumber;
                    entryHolder.AddView(minfield);

//.........这里部分代码省略.........
开发者ID:erdennis13,项目名称:EthansList,代码行数:101,代码来源:SearchOptionsFragment.cs

示例8: createUI

        private void createUI(MessageDB message, UserDB contact)
        {
            #if DEBUG
            System.Diagnostics.Debug.WriteLine ("AccoundID (MC) = {0}", AndroidData.CurrentUser.AccountID.ToString ());
            #endif
            int m = 0;
            string messager = "";
            if (message != null && contact != null) {
                RunOnUiThread (delegate {
                    ImageView random = null;
                    LinearLayout layout = new LinearLayout (context);
                    layout.Orientation = Android.Widget.Orientation.Horizontal;
                    layout.SetGravity (GravityFlags.CenterVertical);
                    layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                    ImageView profilepic = new ImageView (context);
                    profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (60f, context), (int)ImageHelper.convertDpToPixel (100f, context));
                    profilepic.Tag = new Java.Lang.String ("profilepic_" + m.ToString ());

                    if (contact == null)
                        profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                    else {
                        if (contact.Picture.Length > 0) {
                            //profilepic.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromStream(new MemoryStream(eachContact.ContactUser.Picture), "Profile"));
                            loadProfilePicture (contact.AccountID);
                        } else {
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                        }

                        //layout.AddView(profilepic);

                        LinearLayout layout2 = new LinearLayout (context);
                        layout2.Orientation = Orientation.Vertical;
                        layout2.SetGravity (GravityFlags.Center);

                        TextView name = new TextView (context);
                        name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                        name.Gravity = GravityFlags.Center;
                        name.SetTextColor (Color.White);
                        name.TextSize = 16f;
                        name.Text = contact.FirstName + " " + contact.LastName;

                        layout2.AddView (name);

                        TextView text = new TextView (context);
                        text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                        text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                        text.Gravity = GravityFlags.CenterVertical;
                        if (name.Text == isMe)
                            text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                        else
                            text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                        text.TextSize = 16f;

                        for (int e = 0; e < message.MessageStepDBList.Count; ++e) {
                            if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) {
                                messager = message.MessageStepDBList [e].MessageText;
                                break;
                            }
                        }

                        if (string.IsNullOrEmpty (messager))
                            messager = "No text message found";

                        int nolines = messager.Length / 27;
                        text.SetHeight ((nolines + 1) * 20);

                        text.SetTextColor (Android.Graphics.Color.Black);
                        text.Text = messager;
                        layout2.Clickable = true;
                        layout2.AddView (text);
                        if (message.MessageStepDBList.Count > 1) {
                            LinearLayout layout3 = new LinearLayout (context);
                            layout3.Orientation = Orientation.Horizontal;
                            if (name.Text == isMe)
                                layout3.SetGravity (GravityFlags.Right);
                            else
                                layout3.SetGravity (GravityFlags.Left);
                            layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                            layout3.SetMinimumHeight (30);
                            layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                            if (name.Text != isMe) {
                                random = new ImageView (context);
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                //random.Click += delegate { PlayMessage(message); };
                                layout3.AddView (random);
                            }

                            for (int i = 1; i < message.MessageStepDBList.Count; ++i) {
                                switch (message.MessageStepDBList [i].StepType) {
                                case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.drawicon);
                                    layout3.AddView (random);
                                    break;
//.........这里部分代码省略.........
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:ConversationActivity.cs

示例9: createMessageBar

 private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver)
 {
     RunOnUiThread(delegate
     {
         LinearLayout icons = new LinearLayout(context);
         ImageView random = null;
         icons.Orientation = Orientation.Horizontal;
         icons.SetGravity(GravityFlags.Left);
         icons.SetVerticalGravity(GravityFlags.CenterVertical);
         icons.SetMinimumHeight(30);
         int topPos = 0;
         if (wowZapp.LaffOutOut.Singleton.resizeFonts)
             topPos = 0;
         icons.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0);
         if (message.MessageStepDBList.Count == 0)
         {
             using (random = new ImageView (context))
             {
                 using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)))
                 {
                     lp.SetMargins(0, 0, leftOver - (int)ImageHelper.convertDpToPixel(30f, context), 0);
                     random.LayoutParameters = lp;
                 }
                 random.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(30f, context), (int)ImageHelper.convertDpToPixel(30f, context));
                 random.SetBackgroundResource(Resource.Drawable.playblack);
                 random.ContentDescription = message.MessageGuid;
                 random.Click += delegate
                 {
                     Messages.MessageReceived m = new Messages.MessageReceived(message, context);
                 };
                 icons.AddView(random);
             }
         } else
         {
             int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count;
             int iconSize = (int)ImageHelper.convertDpToPixel(34f, context);
             int toEnd = leftOver - (2 * iconSize) - (end * iconSize);
             for (int i = 0; i < end; ++i)
             {
                 switch (message.MessageStepDBList [i].StepType)
                 {
                     case LOLMessageDelivery.MessageStep.StepTypes.Text:
                         using (random = new ImageView (context))
                         {
                             using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)))
                             {
                                 lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0);
                                 random.LayoutParameters = lp;
                             }
                             random.SetBackgroundResource(Resource.Drawable.textmsg);
                             random.ContentDescription = message.MessageID.ToString();
                             random.Click += new EventHandler(imgMessage_Click);
                             icons.AddView(random);
                         }
                         break;
                     case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                         using (random = new ImageView (context))
                         {
                             using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)))
                             {
                                 lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0);
                                 random.LayoutParameters = lp;
                             }
                             random.SetBackgroundResource(Resource.Drawable.drawicon);
                             random.ContentDescription = message.MessageID.ToString();
                             random.Click += new EventHandler(imgMessage_Click);
                             icons.AddView(random);
                         }
                         break;
                     case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                         using (random = new ImageView (context))
                         {
                             using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)))
                             {
                                 lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0);
                                 random.LayoutParameters = lp;
                             }
                             random.SetBackgroundResource(Resource.Drawable.comicon);
                             random.ContentDescription = message.MessageID.ToString();
                             random.Click += new EventHandler(imgMessage_Click);
                             icons.AddView(random);
                         }
                         break;
                     case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                         using (random = new ImageView (context))
                         {
                             using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)))
                             {
                                 lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0);
                                 random.LayoutParameters = lp;
                             }
                             random.SetBackgroundResource(Resource.Drawable.comix);
                             random.ContentDescription = message.MessageID.ToString();
                             random.Click += new EventHandler(imgMessage_Click);
                             icons.AddView(random);
                         }
                         break;
                     case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                         using (random = new ImageView (context))
                         {
//.........这里部分代码省略.........
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:MessageListUI.cs

示例10: CreateButtonContainer

		/// <summary>
		/// Creates the button container. Used to clean up code and with button for desiging meal/
		/// </summary>
		/// <returns>The button container object.</returns>
		/// <param name="json">Json to be parsed.</param>
		/// <param name="count">Count used to create unique ids.</param>
		private LinearLayout CreateButtonContainer (JsonValue json, int count)
		{
			LinearLayout buttonCont = new LinearLayout (this);
			//buttonCont.SetBackgroundColor (Android.Graphics.Color.White);
			buttonCont.Orientation = Orientation.Horizontal;
			buttonCont.SetMinimumWidth (25);
			buttonCont.SetMinimumHeight (100);
			LinearLayout.LayoutParams bcll = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, 
					LinearLayout.LayoutParams.WrapContent);
			bcll.SetMargins (5, 5, 5, 5);
			buttonCont.LayoutParameters = bcll;
			buttonCont.Visibility = Android.Views.ViewStates.Visible;
			buttonCont.Id = count * 20 + 6;
			// Used to hold more values
			MealButton button = new MealButton (this, null, 
				                    Resource.Style.generalButtonStyle); 
			button.mealName = json ["Mealname"];
			button.mealSize = (json ["Mealsize"]);
			button.SetHeight (150);
			button.mealId = (json ["Mealid"]);
			button.Click += (object sender, EventArgs e) => {
				Intent intent = new Intent (this, typeof(MealDesign));
				LinearLayout mealDisplay = FindViewById<LinearLayout> (Resource.Id.MealDisplay);
				// PRINTS
				mealDisplay.RemoveAllViews ();
				intent.PutExtra ("Name", button.mealName);
				intent.PutExtra ("Mealsize", button.mealSize);
				intent.PutExtra ("mealId", button.mealId);
				StartActivityForResult (intent, 3);
				// requestCode for Design page 3

			};
			LinearLayout.LayoutParams lp = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, 
					LinearLayout.LayoutParams.MatchParent);
			button.LayoutParameters = lp;
			button.Text = json ["Mealname"];

			button.Visibility = Android.Views.ViewStates.Visible;
			button.SetBackgroundColor (Resources.GetColor (Resource.Color.orange_header));
			button.Gravity = GravityFlags.Center;
			buttonCont.AddView (button);
			return buttonCont;
		}
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:51,代码来源:MealPlannerCalendar.cs

示例11: CreateMealInfo

		/// <summary>
		/// Creates the meal info area in the programmitcally generated by Json.
		/// </summary>
		/// <returns>The meal info container for orginal Json calls.</returns>
		/// <param name="json">Json from original call to be parsed.</param>
		/// <param name="recipeResult">Recipe result (Json) using info from original Json.</param>
		/// <param name="count">Count used for creating unique ids.</param>
		private LinearLayout CreateMealInfo (JsonValue json, 
		                                     JsonValue recipeResult, int count)
		{
			LinearLayout mealInfo = new LinearLayout (this);
			mealInfo.Orientation = Orientation.Horizontal;
			mealInfo.SetMinimumWidth (25);
			mealInfo.SetMinimumHeight (25);
			LinearLayout.LayoutParams mealInfoLL = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, 
					LinearLayout.LayoutParams.WrapContent);
			mealInfoLL.SetMargins (5, 5, 5, 5);
			mealInfo.LayoutParameters = mealInfoLL;
			mealInfo.Id = count * 20 + 7;
			// Set image icon
			ImageView dinerIcon = new ImageView (this);
			dinerIcon.SetImageResource (Resource.Drawable.gray_person);
			dinerIcon.LayoutParameters = new 
				LinearLayout.LayoutParams (50, LinearLayout.LayoutParams.MatchParent);
			// Finish setting the image icon
			TextView mealSize = new TextView (this);
			TextView recipeInfo = new TextView (this);
			recipeInfo.Text = handleRecipeJson (recipeResult);
			recipeInfo.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
			recipeInfo.SetLines (1);
			LinearLayout.LayoutParams rill = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, 
					LinearLayout.LayoutParams.WrapContent);
			recipeInfo.LayoutParameters = rill;
			mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
			LinearLayout.LayoutParams tvll = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, 
					LinearLayout.LayoutParams.WrapContent);
			mealSize.LayoutParameters = tvll;
			mealSize.Text = json ["Mealsize"].ToString ();
			recipeInfo.SetPadding (10, 0, 0, 0);
			mealSize.Gravity = GravityFlags.Right;
			// Add image icon
			mealInfo.AddView (mealSize);
			mealInfo.AddView (dinerIcon);
			mealInfo.AddView (recipeInfo);
			return mealInfo;
		}
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:49,代码来源:MealPlannerCalendar.cs

示例12: makeObjects

		/// <summary>
		/// Makes meal segments for the calendar page
		/// </summary>
		/// <param name="json">Json to parse information to use for displaying.</param>
		/// <param name="count">Count used for unique ids.</param>
		/// <param name="mealDisplay">Meal display (LinearLayout) that all of the 
		/// 		objects are going to be added to.</param>
		private async void makeObjects (JsonValue json, 
		                                int count, LinearLayout mealDisplay)
		{
			LinearLayout mealObject = new LinearLayout (this);
			mealObject.Orientation = Orientation.Vertical;
			mealObject.SetMinimumWidth (25);
			mealObject.SetMinimumHeight (25);
			LinearLayout.LayoutParams mealObjectLL = 
				new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, 
					LinearLayout.LayoutParams.WrapContent);
			mealObject.LayoutParameters = mealObjectLL;
			mealObject.Id = count * 20 + 5;
			// Adds button container here
			mealObject.AddView (CreateButtonContainer (json, count));
			// Additional Json information to be used
			string user = "tester";
			int mealId = json ["Mealid"];
			string url = "http://speedychef.azurewebsites.net/" +
			             "CalendarScreen/GetRecipesForMeal?user="
			             + user + "&mealId=" + mealId;
			JsonValue recipeResult = await FetchMealData (url);
			mealObject.AddView (ButtonView (json, recipeResult, count));
			mealObject.SetPadding (0, 0, 0, 40);
			mealDisplay.AddView (mealObject);
		}
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:32,代码来源:MealPlannerCalendar.cs


注:本文中的LinearLayout.SetMinimumHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。