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


C# LinearLayout.SetBackgroundResource方法代码示例

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


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

示例1: Tap5050MenuBuilder

 // int all in dp
 public Tap5050MenuBuilder(Context context,int backgroundresource=Resource.Color.soarnix_bg_gray,int containerpadding=5,int containerspacing=1)
 {
     nn_containerspacing = containerspacing;
     nn_containterpadding=containerpadding;
     nn_context = context;
     nn_menucontainer = new LinearLayout (context);
     nn_menucontainer.SetBackgroundResource (backgroundresource);
     nn_menucontainer.SetPadding (TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding));
     nn_menucontainer.Orientation = Orientation.Vertical;
     nn_itemlist = new List<RelativeLayout>();
 }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:12,代码来源:Tap5050MenuBuilder.cs

示例2: ini

		public void ini(){


			var textFormat = Android.Util.ComplexUnitType.Px;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);


			contenLayout = new LinearLayout (context);
			contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
			contenLayout.Orientation = Orientation.Vertical;


			//LIST

			contentListLayout = new LinearLayout (context);
			contentListLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(583),Configuration.getHeight(300));
			contentListLayout.Orientation = Orientation.Vertical;
			titleHeaderList = new TextView (context);
			contentList = new ListView (context);

			//titleHeaderList.Text = "Tipos de Aves";
			titleHeaderList.SetTextColor (Color.ParseColor ("#FF0080"));
			titleHeaderList.SetTextSize (textFormat, Configuration.getHeight (38));
			titleHeaderList.SetMaxWidth (Configuration.getWidth (510));

			contentListLayout.SetBackgroundResource (Resource.Drawable.border);
			contentListLayout.AddView (titleHeaderList);
			contentListLayout.AddView (contentList);


			contentListLayout.SetX (Configuration.getHeight (25));
			//contentListLayout.SetY (Configuration.getWidth (450));


			//ENDLIST

			imBorderList = new ImageView (context);
			mainLayout.AddView (contentListLayout);
		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:41,代码来源:Template3.cs

示例3: createConfigPicker

        private LinearLayout createConfigPicker()
        {
            LinearLayout holder = new LinearLayout (context);
            holder.Orientation = Orientation.Horizontal;
            holder.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            holder.SetBackgroundResource (Resource.Drawable.footerback);

            LinearLayout level2 = new LinearLayout (context);
            level2.Orientation = Orientation.Vertical;
            level2.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), LinearLayout.LayoutParams.FillParent);

            LinearLayout topSeekHolder = new LinearLayout (context);
            topSeekHolder.Orientation = Orientation.Horizontal;
            LinearLayout.LayoutParams viewParams;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0, 0);
            topSeekHolder.LayoutParameters = viewParams;

            SeekBar topSeek = new SeekBar (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (15f, context), 0);
            topSeek.LayoutParameters = viewParams;
            topSeekHolder.AddView (topSeek);

            LinearLayout set1 = new LinearLayout (context);
            set1.Orientation = Orientation.Horizontal;
            set1.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set1Text = new TextView (context);
            set1Text.SetTextColor (Color.Black);
            set1Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set1Text.Gravity = GravityFlags.CenterHorizontal;
            set1Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set1Text.Text = "1";
            HorizontalScrollView set1HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set1HSV.LayoutParameters = viewParams;
            set1.AddView (set1Text);
            set1.AddView (set1HSV);

            LinearLayout gap1 = new LinearLayout (context);
            gap1.Orientation = Orientation.Vertical;
            gap1.SetBackgroundColor (Color.Brown);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap1.LayoutParameters = viewParams;
            set1.AddView (gap1);

            LinearLayout set2 = new LinearLayout (context);
            set2.Orientation = Orientation.Horizontal;
            set2.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set2Text = new TextView (context);
            set2Text.SetTextColor (Color.Black);
            set2Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set2Text.Gravity = GravityFlags.CenterHorizontal;
            set2Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set2Text.Text = "2";
            HorizontalScrollView set2HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set2HSV.LayoutParameters = viewParams;
            set2.AddView (set2Text);
            set2.AddView (set2HSV);

            LinearLayout gap2 = new LinearLayout (context);
            gap2.Orientation = Orientation.Vertical;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap2.LayoutParameters = viewParams;
            gap2.SetBackgroundColor (Color.Brown);
            set2.AddView (gap2);

            LinearLayout set3 = new LinearLayout (context);
            set3.Orientation = Orientation.Horizontal;
            set3.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set3Text = new TextView (context);
            set3Text.SetTextColor (Color.Black);
            set3Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set3Text.Gravity = GravityFlags.CenterHorizontal;
            set3Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set3Text.Text = "3";
            HorizontalScrollView set3HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set3HSV.LayoutParameters = viewParams;
            set3.AddView (set3Text);
            set3.AddView (set3HSV);

            LinearLayout gap3 = new LinearLayout (context);
            gap3.Orientation = Orientation.Vertical;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap3.LayoutParameters = viewParams;
            gap3.SetBackgroundColor (Color.Brown);
            set3.AddView (gap3);

            LinearLayout set4 = new LinearLayout (context);
            set4.Orientation = Orientation.Horizontal;
            set4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set4Text = new TextView (context);
//.........这里部分代码省略.........
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:CreateAnimationActivityDesigner.cs

示例4: createUI

        private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false)
        {
            message.Reverse ();
            contact.Reverse ();
            int m = 0;
            string messager = "";
            bool dd = false;
            if (message != null && contact != null) {

                if (clear == false)
                    RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ());
                string othername = string.Empty;
                for (int i = 0; i < contact.Count; ++i) {
                    if (string.IsNullOrEmpty (nameTitle))
                        othername = contact [i].FirstName + " " + contact [i].LastName;
                    else
                        othername = nameTitle;
                    if (isMe != othername) {
                        RunOnUiThread (delegate {
                            Header.headertext = othername;
                            Header.fontsize = 36f;
                            ImageHelper.fontSizeInfo (header.Context);
                            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
                            header.Text = Header.headertext;
                        });
                        break;
                    }
                }

                if (contact.Count > 1) {
                    string toReturn = "";
                    List<UserDB> sortedList = new List<UserDB> ();
                    sortedList = contact.OrderBy (s => s.LastName).OrderBy (s => s.FirstName).ToList ();
                    foreach (UserDB eachItem in sortedList)
                        toReturn += string.Format ("{0} {1}, ", eachItem.FirstName, eachItem.LastName);
                    int last = toReturn.LastIndexOf (", ");
                    toReturn = toReturn.Remove (last);
                    RunOnUiThread (delegate {
                        using (LinearLayout btnlayout = new LinearLayout (context)) {
                            btnlayout.Orientation = Android.Widget.Orientation.Vertical;
                            btnlayout.SetGravity (GravityFlags.Center);
                            btnlayout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                            btnlayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                            using (TextView name = new TextView(context)) {
                                name.Text = toReturn;
                                name.SetTextSize (Android.Util.ComplexUnitType.Dip, 18f);
                                name.SetTextColor (Color.Black);
                                btnlayout.AddView (name);
                            }

                            using (Button showAll = new Button (context)) {
                                showAll.Gravity = GravityFlags.CenterVertical;
                                showAll.Text = Application.Context.Resources.GetString (Resource.String.messageShowAllInConversation);
                                showAll.Click += (object sender, EventArgs e) => {
                                    showParticipants (sender, e, contact); };
                                showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context));
                                showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context));
                                showAll.SetBackgroundResource (Resource.Drawable.button);
                                btnlayout.AddView (showAll);
                            }
                            listWrapper.AddView (btnlayout);
                        }
                    });
                }

                if (getGuid != null)
                    getGuid.Clear ();

                RunOnUiThread (delegate {
                    foreach (MessageDB messages in message) {
                        string name = contact [m].FirstName + " " + contact [m].LastName;

                        ImageView random = null;
                        LinearLayout layout = new LinearLayout (context);
                        layout.Orientation = Android.Widget.Orientation.Horizontal;
                        layout.SetGravity (GravityFlags.CenterVertical);
                        layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                        LinearLayout layout2 = new LinearLayout (context);
                        layout2.Orientation = Orientation.Vertical;
                        layout2.SetGravity (GravityFlags.Center);
                        if (name == isMe)
                            layout.AddView (contactUserInterface (messages, contact [m], true));
                        else
                            layout.AddView (contactUserInterface (messages, contact [m], false));

                        /*ImageView profilepic = new ImageView (context);
                        profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));

                        if (contact == null)
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                        else {
                            profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID);
                            profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                            layout.AddView (profilepic);
                            if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage)
                                getGuid.Add (contact [m].AccountID);
                            else {
                                if (contact [m].Picture.Length > 0)
                                    LoadUserImage (contact [m], profilepic);
//.........这里部分代码省略.........
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:MessageReceivedActivityUI.cs

示例5: CreatePreviewUI


//.........这里部分代码省略.........
                            LinearLayout layout2 = new LinearLayout (context);
                            layout2.Orientation = Orientation.Vertical;
                            layout2.SetGravity (GravityFlags.Left);

                            using (TextView name = new TextView (context)) {
                                name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (25f, context));
                                name.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (20f, context), 0);
                                name.Gravity = GravityFlags.Left;
                                name.SetTextColor (Color.White);
                                name.TextSize = 16f;
                                tmpName = who.FirstName + " " + who.LastName;
                                if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) {
                                    if (eachMessage.Value.Message.MessageRecipientDBList.Count == 1 || eachMessage.Value.Message.MessageRecipientDBList.Count - 1 == 1)
                                        tmpName += "   1 other";
                                    else
                                        tmpName += "   " + string.Format ("{0} others", eachMessage.Value.Message.MessageRecipientDBList.Count - 1);
                                }

                                name.Text = tmpName;
                                layout2.AddView (name);
                            }

                            if (eachMessage.Value.Message.MessageStepDBList.Count == 1 && eachMessage.Value.Message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                                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 = "";

                                    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);
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:67,代码来源:MessageReceivedActivityUI.cs

示例6: ini

		public void ini(){


			var textFormat = Android.Util.ComplexUnitType.Px;

			var textFormatdip = Android.Util.ComplexUnitType.Dip;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			mainLinearLayout = new LinearLayout (context);
			headerLinearLayout = new LinearLayout (context);
			contentLinearLayout = new LinearLayout (context);
			mainHeaderLinearLayout = new LinearLayout (context);


			imHeader = new ImageView (context);
			titleHeader = new TextView (context);
			AutorHeader = new TextView (context);
			content = new TextView (context);

			titleHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			AutorHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			content.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");


			mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125));
			contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);

			mainLinearLayout.Orientation = Orientation.Vertical;
			mainHeaderLinearLayout.Orientation = Orientation.Horizontal;
			headerLinearLayout.Orientation = Orientation.Vertical;
			contentLinearLayout.Orientation = Orientation.Vertical;


			mainLinearLayout.AddView (mainHeaderLinearLayout);
			mainLinearLayout.AddView (contentLinearLayout);

			mainHeaderLinearLayout.AddView (imHeader);
			mainHeaderLinearLayout.AddView (headerLinearLayout);


			headerLinearLayout.AddView (titleHeader);
			headerLinearLayout.AddView (AutorHeader);
			headerLinearLayout.SetPadding (15, 0, 0, 10);
			AutorHeader.SetPadding (0, 15, 0, 0);

			contentLinearLayout.AddView (content);
			contentLinearLayout.SetPadding (0, 15, 0, 0);


			mainLinearLayout.SetBackgroundResource (Resource.Drawable.border);
			//			mainLinearLayout.SetX (Configuration.getHeight (45));
			//mainLinearLayout.SetY (Configuration.getWidth (500));



			//titleHeader.Text = "Diferentes tipos de aves en Perú";
			titleHeader.SetTextColor (Color.ParseColor ("#FF0080"));
			//titleHeader.SetTextSize (textFormat, Configuration.getHeight (38));
			titleHeader.SetTextSize (textFormatdip, 16.0f);

			titleHeader.SetMaxWidth (Configuration.getWidth (274));
			titleHeader.SetMaxHeight (Configuration.getHeight (80));
			//titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion));
			titleHeader.Ellipsize = TextUtils.TruncateAt.End;
			titleHeader.SetMaxLines(2);


			//AutorHeader.Text = "Autor del Articulo";
			AutorHeader.SetTextColor(Color.ParseColor ("#424242"));
			AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23));
			AutorHeader.SetMaxWidth (Configuration.getWidth (274));
			//AutorHeader.SetMaxHeight (Configuration.getHeight (25));
			//AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion));
			AutorHeader.Ellipsize = TextUtils.TruncateAt.End;
			AutorHeader.SetMaxLines(1);

			//content.Text = "Los factores geográficos, climáticos y evolutivos  convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de";
			//content.SetTextSize (textFormat, Configuration.getHeight (24));
			content.SetTextSize (textFormatdip, 12.0f);
			content.SetMaxWidth (Configuration.getWidth(501));
			//content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion));
			//content.Ellipsize = TextUtils.TruncateAt.End;
			//content.SetMaxLines(4);

			//imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true));
			//imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion));
			imHeader.SetMaxWidth (Configuration.getWidth (124));
			imHeader.SetMaxHeight (Configuration.getWidth (124));




			int padW = Configuration.getWidth(45);
			int padH = Configuration.getHeight (15);

			mainLayout.SetPadding (padW,padH,padW,padH);
//.........这里部分代码省略.........
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:101,代码来源:Template1.cs

示例7: OnCreateView

		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			ctrl = ((GameController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.GameDetailScreen, container, false);

			_layoutDefault = view.FindViewById<ScrollView> (Resource.Id.scrollView);

			_imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			_imageDirection = view.FindViewById<ImageView> (Resource.Id.imageDirection);
			_textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			_textDirection = view.FindViewById<TextView> (Resource.Id.textDirection);
			_layoutBottom = view.FindViewById<LinearLayout> (Resource.Id.layoutBottom);
			_layoutButtons = view.FindViewById<LinearLayout> (Resource.Id.layoutButtons);
			_layoutDirection = view.FindViewById<LinearLayout> (Resource.Id.layoutDirection);

			// Don't know a better way :(
			_layoutBottom.SetBackgroundResource(Main.BottomBackground);

			_layoutButtons.Visibility = ViewStates.Visible;

			HasOptionsMenu = !(activeObject is Task);

			return view;
		}
开发者ID:WFoundation,项目名称:WF.Player.Android,代码行数:30,代码来源:GameDetailScreenAndroid.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: ini

		public void ini(){

			_txtCursoN = new TextView (context);
			_txtCursoN.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			_txtUnidadN = new TextView (context);
			_mainLayout = new RelativeLayout (context);

			linearGradiente = new LinearLayout (context);
			linearGradiente.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (310));
			linearGradiente.SetBackgroundResource (Resource.Drawable.gradiente);


			var textFormat = Android.Util.ComplexUnitType.Px;

			_mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);

			_scrollSpace = new VerticalScrollView (context);
			_scrollSpace.LayoutParameters = new VerticalScrollView.LayoutParams (-1, Configuration.getHeight(1015-85));
			_scrollSpace.SetY (Configuration.getHeight (125));
			//_scrollSpace.SetBackgroundColor (Color.ParseColor ("#FF0000"));
			_mainLayout.AddView (_scrollSpace);


			_publicidadLayout = new LinearLayout (context);
			_publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (85));
			Drawable dr = new BitmapDrawable (getBitmapFromAsset ("images/footerad.jpg"));
			_publicidadLayout.SetBackgroundDrawable (dr);
			_publicidadLayout.SetY (Configuration.getHeight(1136-85));
			_mainLayout.AddView (_publicidadLayout);
			_publicidadLayout.Click += delegate {
				if (adOpen) {
					hideAd ();
				} else {
					Random rnd = new Random();
					showAd (rnd.Next(adsImagesPath.Count));
				}
			};




			_mapSpace = new LinearLayout (context);

			_mapSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (1015));
			_mapSpace.SetY(Configuration.getHeight (125));
			_mainLayout.AddView (_mapSpace);


			_mainSpace = new LinearLayout (context);
			_mainSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			_mainSpace.Orientation = Orientation.Vertical;

			_scrollSpace.AddView (_mainSpace);

			_fondo2 = new RelativeLayout (context);
			_fondo2.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getWidth (640));
			_fondo2.SetY (Configuration.getHeight (0));

			Drawable dr1 = new BitmapDrawable (getBitmapFromAsset("icons/fondoselec.png"));
			_fondo2.SetBackgroundDrawable (dr1);
			dr1 = null;

			_mainSpace.AddView (_fondo2);

			infoCursoUnidad = new LinearLayout (context);
			infoCursoUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(250));
			infoCursoUnidad.Orientation = Orientation.Vertical;
			infoCursoUnidad.SetGravity(Android.Views.GravityFlags.Right);
			infoCursoUnidad.SetPadding (Configuration.getWidth(30), Configuration.getWidth (25), Configuration.getWidth(30), Configuration.getWidth (25));
			infoCursoUnidad.SetBackgroundColor (Color.ParseColor ("#40000000"));

			TextView _txtCurso = new TextView (context);
			_txtCurso.Text = Resource.String.THE_ROUTES.ToString ();;
			_txtCurso.SetY (-100);

			//section1-----------------------------------------------
			_contentRLayout_S1 = new RelativeLayout(context);
			_txtTitle_S1 = new TextView (context);
			_txtAuthor_S1 = new TextView (context);
			_imAuthor_S1 = new ImageView (context);
			_txtChapter_S1 = new TextView (context);

			_itemsLayout_S1 = new LinearLayout (context);//not used
			_imItem_S1 = new List<ImageView> ();
			_txtItem_S1 = new List<TextView>();

			_contentRLayout_S1.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getHeight (480));

			LinearLayout _linearTitle = new LinearLayout (context);
			_linearTitle.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			_linearTitle.SetGravity (Android.Views.GravityFlags.Center);
			_linearTitle.AddView (_txtTitle_S1);
			_linearTitle.SetY (Configuration.getHeight (60));

			linearGradiente.SetX (0); linearGradiente.SetY (Configuration.getHeight(860));
			//_mainLayout.AddView (linearGradiente);
			//_mainLayout.AddView (_linearTitle);

			//_txtTitle_S1.SetX (Configuration.getWidth (245));_txtTitle_S1.SetY (Configuration.getHeight (60));

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

示例10: AddSubCategories

        void AddSubCategories()
        {
            ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);

            var index = 0;
            foreach (var item in items)
            {
                LinearLayout row = new LinearLayout(context);
                row.Orientation = Orientation.Horizontal;
                row.LayoutParameters = p;

                TextView subCategory = new TextView(context);
                subCategory.LayoutParameters = p;

                subCategory.Gravity = GravityFlags.CenterVertical;
                subCategory.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f);
                subCategory.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));

                subCategory.Text = item.Value;
                row.AddView(subCategory);

                row.Click += (object sender, EventArgs e) =>
                {
                    row.SetBackgroundResource(Android.Resource.Color.HoloBlueLight);
                    if (this.CategorySelected != null)
                        this.CategorySelected(this, new CategorySelectedEventArgs { Selected = item });
                };

                row.LongClick += (sender, e) =>
                {
                    if (this.CategoryLongClick != null)
                        CategoryLongClick(this, new CategorySelectedEventArgs { Selected = item, SelectedView = row });
                };

                AddView(row);
                index++;
            }
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:38,代码来源:CategoryGroupRow.cs

示例11: OnCreateView

		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.GameDialogScreen, container, false);

			imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			spinnerInput = view.FindViewById<Spinner> (Resource.Id.spinnerMulti);
			editInput = view.FindViewById<EditText> (Resource.Id.editInput);
			layoutDialog = view.FindViewById<LinearLayout> (Resource.Id.layoutDialog);
			layoutInput = view.FindViewById<LinearLayout> (Resource.Id.layoutInput);
			layoutButton = view.FindViewById<LinearLayout> (Resource.Id.layoutButton);

			// Don't know a better way
			layoutDialog.SetBackgroundResource(Main.BottomBackground);
			layoutButton.SetBackgroundResource(Main.BottomBackground);

			if (input == null) {
				// Normal dialog
				layoutDialog.Visibility = ViewStates.Visible;
				layoutInput.Visibility = ViewStates.Gone;

				btnView1 = view.FindViewById<Button> (Resource.Id.button1);
				btnView1.SetTextColor(Color.White);
				btnView1.SetBackgroundResource(Main.ButtonBackground);
				btnView1.Click += OnButtonClicked;

				btnView2 = view.FindViewById<Button> (Resource.Id.button2);
				btnView2.SetTextColor(Color.White);
				btnView2.SetBackgroundResource(Main.ButtonBackground);
				btnView2.Click += OnButtonClicked;
			} else {
				if (input.InputType == InputType.MultipleChoice) {
					// Multiple choice dialog
					layoutDialog.Visibility = ViewStates.Gone;
					layoutInput.Visibility = ViewStates.Visible;
					spinnerInput.Visibility = ViewStates.Visible;
					editInput.Visibility = ViewStates.Gone;
				} else {
					// Input dialog
					layoutDialog.Visibility = ViewStates.Gone;
					layoutInput.Visibility = ViewStates.Visible;
					spinnerInput.Visibility = ViewStates.Gone;
					editInput.Visibility = ViewStates.Visible;

					editInput.Text = "";
					editInput.EditorAction += HandleEditorAction;  
				}

				btnInput = view.FindViewById<Button> (Resource.Id.buttonInput);
				btnInput.Text = ctrl.Resources.GetString(Resource.String.done);
				btnInput.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
				btnInput.Click += OnInputClicked;
			}

			return view;
		}
开发者ID:WFoundation,项目名称:WF.Player.Android,代码行数:64,代码来源:GameDialogScreen.cs

示例12: Initialize

        void Initialize()
        {
            ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
            this.Orientation = Orientation.Vertical;

            LinearLayout row = new LinearLayout(context);
            row.Orientation = Orientation.Horizontal;
            row.LayoutParameters = p;
            row.SetBackgroundResource(Resource.Color.headerColor);

            headerLabel = new TextView(context);
            headerLabel.LayoutParameters = p;
            //headerLabel.SetTextSize(ComplexUnitType.Dip, 20);

            headerLabel.Gravity = GravityFlags.CenterVertical;
            headerLabel.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.50f);
            headerLabel.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));

            row.AddView(headerLabel);

            AddView(row);
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:22,代码来源:CategoryGroupRow.cs

示例13: ini

		public void ini(){


			//creating comment List



			commentLayout = new LinearLayout(context);
			commentLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (934));
			commentList = new ListView (context);


			//commentList.AddView (commentList);



			//end comment List

			_mainLayout = new RelativeLayout (context);


			linearGradiente = new LinearLayout (context);
			linearGradiente.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (541));
			linearGradiente.SetBackgroundResource (Resource.Drawable.gradiente);


			var textFormat = Android.Util.ComplexUnitType.Px;

			_mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);

			_fondo2 = new LinearLayout (context);
			_fondo2.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getWidth (640));
			_fondo2.SetY (Configuration.getHeight (109));

			Drawable dr1 = new BitmapDrawable (getBitmapFromAsset("icons/fondoselec.png"));
			_fondo2.SetBackgroundDrawable (dr1);
			dr1 = null;
			_mainLayout.AddView (_fondo2);

			//section1-----------------------------------------------
			_contentRLayout_S1 = new RelativeLayout(context);
			_txtTitle_S1 = new TextView (context);
			_txtAuthor_S1 = new TextView (context);
			_imAuthor_S1 = new ImageView (context);
			_txtChapter_S1 = new TextView (context);

			_itemsLayout_S1 = new LinearLayout (context);//not used
			_imItem_S1 = new List<ImageView> ();
			_txtItem_S1 = new List<TextView>();





			//_mainLayout.AddView (_txtTitle_S1);
			//_mainLayout.AddView (_txtAuthor_S1);
			_mainLayout.AddView (_imAuthor_S1);

			//_mainLayout.AddView (_txtChapter_S1);







			_contentRLayout_S1.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getHeight (480));


			LinearLayout _linearTitle = new LinearLayout (context);
			_linearTitle.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			_linearTitle.SetGravity (Android.Views.GravityFlags.Center);
			_linearTitle.AddView (_txtTitle_S1);
			_linearTitle.SetY (Configuration.getHeight (60));

			linearGradiente.SetX (0); linearGradiente.SetY (Configuration.getHeight(502));
			_mainLayout.AddView (linearGradiente);
			_mainLayout.AddView (_linearTitle);

			//_txtTitle_S1.SetX (Configuration.getWidth (245));_txtTitle_S1.SetY (Configuration.getHeight (60));

			Bitmap newbm = Configuration.getRoundedShape(Bitmap.CreateScaledBitmap( getBitmapFromAsset("icons/imgautor.png"), Configuration.getWidth(170), Configuration.getWidth(170), true),Configuration.getWidth(170),Configuration.getHeight(170));
		
			_imAuthor_S1.SetImageBitmap (newbm);
		//	newbm.Recycle ();
			newbm = null;

			_imAuthor_S1.SetX (Configuration.getWidth (240));_imAuthor_S1.SetY (Configuration.getHeight (189));

			LinearLayout _linearAuthor = new LinearLayout (context);
			_linearAuthor.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			_linearAuthor.SetGravity (Android.Views.GravityFlags.Center);
			_linearAuthor.AddView (_txtAuthor_S1);
			_linearAuthor.SetY (Configuration.getHeight (378));
			_mainLayout.AddView (_linearAuthor);

			//_txtAuthor_S1.SetX (Configuration.getWidth (228));_txtAuthor_S1.SetY (Configuration.getHeight (378));

			LinearLayout _linearChapter = new LinearLayout (context);
			_linearChapter.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
//.........这里部分代码省略.........
开发者ID:Milton761,项目名称:MLRepo,代码行数:101,代码来源:WallView.cs

示例14: CreateDialog

        public IXFPopupCtrl CreateDialog(Page page, Xamarin.Forms.View content,bool cancelable)
        {
            CustomDialog dlg = null;
            //first try to get the PopupHolderRenderer

            if (content != null) {

                var render = Convert(content, page);

                if (render != null) {

                    var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT);

                    var width = (int)size.Request.Width;
                    var height = (int)size.Request.Height;

                    if (width > XFPopupConst.SCREEN_WIDTH)
                    {
                        width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4);
                    }

                    if (height > (XFPopupConst.SCREEN_HEIGHT * 3/ 4))
                    {
                        height = (int)(XFPopupConst.SCREEN_HEIGHT * 3/ 4);
                    }

                    //important
                    content.Layout(new Rectangle(0, 0, width, height));

                    float density = Forms.Context.Resources.DisplayMetrics.Density;
                    width = (int)(width * density);
                    height = (int)(height * density);

                    var native = render as Android.Views.View;
                    native.LayoutParameters = new ViewGroup.LayoutParams(width, height);

                    LinearLayout ll = new LinearLayout(Forms.Context);
                    ll.SetBackgroundResource(Resource.Layout.rounded_rectangle_bgr);
                    ll.LayoutParameters = new ViewGroup.LayoutParams(width + 4, height + 4);
                    ll.AddView(native);

                    dlg = new CustomDialog(ll,cancelable);

                }

            }
            return dlg;
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:48,代码来源:DroidXFPopupSrvc.cs

示例15: CreateUI


//.........这里部分代码省略.........
                            txtMessage.LayoutParameters = linParams;
                        }
                        txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context),
                                      (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context));

                        if (latestMessage.MessageStepDBList.Count == 1 && latestMessage.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                            txtMessage = messageTextBox (latestMessage, 0, leftOver);

                        } else {

                            for (int n = 0; n < latestMessage.MessageStepDBList.Count; ++n) {
                                if (latestMessage.MessageStepDBList [n].StepType == MessageStep.StepTypes.Text) {
                                    txtMessage = messageTextBox (latestMessage, n, leftOver);
                                    break;
                                }
                            }
                        }

                        txtMessage.ContentDescription = latestMessage.MessageID.ToString ();
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("ContentDesctription = {0}, ID = {1}", txtMessage.ContentDescription, latestMessage.ID);
                        #endif
                        txtMessage.Click += textMessage_Click;
                        RunOnUiThread (() => messageLayout.AddView (txtMessage));

                        LinearLayout bottomLayout = new LinearLayout (context);
                        using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)) {
                            linParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (3f, context), 0, 0);
                            bottomLayout.LayoutParameters = linParams;
                        }
                        bottomLayout.SetGravity (GravityFlags.Right);

                        TextView txtMessageUnread = new TextView (context);
                        using (LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(12f, context))) {
                            layoutParams.SetMargins (10, 0, 10, 0);
                            txtMessageUnread.LayoutParameters = layoutParams;
                        }
                        txtMessageUnread.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                        txtMessageUnread.SetTextColor (Color.Black);
                        txtMessageUnread.SetTextSize (Android.Util.ComplexUnitType.Dip, 10f);
                        if (unreadMessages [c] == 0)
                            txtMessageUnread.Text = "0 unread messages.";
                        else
                            txtMessageUnread.Text = string.Format ("({0}) unread message{1}", unreadMessages [c], unreadMessages [c] == 1 ? "." : "s.");
                        txtMessageUnread.Gravity = GravityFlags.Right;
                        RunOnUiThread (() => bottomLayout.AddView (txtMessageUnread));

                        LinearLayout messageItems = new LinearLayout (context);
                        if (latestMessage.MessageStepDBList.Count > 0) {

                            messageItems.Orientation = Orientation.Horizontal;
                            float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context);
                            using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) {
                                layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context));
                                messageItems.LayoutParameters = layParams;
                            }
                            messageItems.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0);
                            messageItems.SetGravity (GravityFlags.Left);
                            messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            messageItems = createMessageBar (messageItems, latestMessage, leftOver);
                            messageItems.ContentDescription = latestMessage.MessageGuid;
                            messageItems.Click += messageBar_Click;
                        } else {
                            messageItems.Orientation = Orientation.Horizontal;
                            float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context);
                            using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) {
                                layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context));
                                messageItems.LayoutParameters = layParams;
                                messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            }
                        }
                        RunOnUiThread (delegate {
                            information.AddView (topLayout);
                            if (!string.IsNullOrEmpty (txtMessage.Text))
                                information.AddView (messageLayout);
                            if (latestMessage.MessageStepDBList.Count > 1)
                                information.AddView (messageItems);
                            information.AddView (bottomLayout);

                            shell.AddView (information);
                            listWrapper.AddView (shell);
                        });

                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("done a loop");
                        #endif
                    }
                }
                if (c < MessageConversations.initialMessages.Count - 2)
                    c++;

            }
            //});

            if (unknownUsers.Count != 0) {
                Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser (unknownUsers, context);
            }
            if (progress != null)
                RunOnUiThread (() => progress.Dismiss ());
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:101,代码来源:ConversationsUI-original.cs


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