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


C# LinearLayout.SetVerticalGravity方法代码示例

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


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

示例1: InitView

		public void InitView(List<BookingDocumentDto> _bookingDocs) {
			this.RemoveAllViews ();
			int size = _bookingDocs.Count;
			for(int i = 0; i < size; i ++) {
				LinearLayout ll = new LinearLayout (_context);
				ll.Orientation = Orientation.Horizontal;
				ll.SetVerticalGravity (GravityFlags.CenterVertical);

				ImageView imgFile = new ImageView (_context);
				imgFile.SetImageResource (Resource.Drawable.ic_attach);

				var tvFileAttach = new TextView (_context) {
					Text = _bookingDocs[i].OriginalFileName
				};
				tvFileAttach.Id = i;
				tvFileAttach.SetTextColor (Color.Blue);
				tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
				tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
				tvFileAttach.SetSingleLine (true);
				tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
				tvFileAttach.SetPadding (5, 0, 10, 0);
				LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
				tvFileAttach.LayoutParameters = param;
				tvFileAttach.Click += (sender, e) => {
					utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
				};

				ImageButton imgDelete = new ImageButton (_context);
				imgDelete.Id = i;
				imgDelete.SetImageResource (Resource.Drawable.ic_delete);
				imgDelete.SetMinimumWidth (50);
				imgDelete.SetMinimumHeight (50);
				imgDelete.SetBackgroundColor (Color.Transparent);
				imgDelete.Click += (sender, e) => {
					_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
				};

				ll.AddView (imgFile);
				ll.AddView (tvFileAttach);
				ll.AddView (imgDelete);
				ll.SetPadding (0, 5, 0, 5);

				this.AddView (ll);
			}
		}
开发者ID:borain89vn,项目名称:demo2,代码行数:45,代码来源:OnAddFileToView.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: createUI


//.........这里部分代码省略.........
                                text.Gravity = GravityFlags.CenterVertical;
                                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
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:67,代码来源:MessageReceivedActivityUI.cs

示例4: CreatePreviewUI


//.........这里部分代码省略.........
                                            messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText;
                                            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))
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:67,代码来源:MessageReceivedActivityUI.cs

示例5: 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

示例6: 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


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