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


C# LinearLayout.LayoutParams.SetMargins方法代码示例

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


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

示例1: Initialize

        void Initialize()
        {
            Orientation = Orientation.Horizontal;

            var ps = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
                                                    LinearLayout.LayoutParams.MatchParent,
                                                    1.0f);
            ps.SetMargins (0, 0, 0, 0);

            mLeftView = new CardboardOverlayEyeView (Context);
            mLeftView.LayoutParameters = ps;
            AddView(mLeftView);

            mRightView = new CardboardOverlayEyeView (Context);
            mRightView.LayoutParameters = ps;
            AddView(mRightView);

            // Set some reasonable defaults.
            SetDepthOffset(0.016f);

            SetColor(Color.Rgb (150, 255, 180));
            Visibility = ViewStates.Visible;

            mTextFadeAnimation = new AlphaAnimation(1.0f, 0.0f);
            mTextFadeAnimation.Duration = 5000;
        }
开发者ID:namratasingh123,项目名称:CardboardMonkey,代码行数:26,代码来源:CardboardOverlayView.cs

示例2: OnCreate

        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            mView = new View(this.Activity);

            GradientDrawable background = (GradientDrawable) Resources.GetDrawable(Resource.Drawable.rounded_rect);
            background.SetColor(mColour);

            mView.SetBackgroundDrawable(background);
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, Xamarin.ActionbarSherlockBinding.App.ActionBar.LayoutParams.FillParent, mWeight);
            lp.SetMargins(marginLeft, marginTop, marginRight, marginBottom);
            mView.LayoutParameters = lp;
        }
开发者ID:kbalint,项目名称:SherlockTest,代码行数:13,代码来源:RoundedColourFragment.cs

示例3: AddDevicesToFilterDialog

        private void AddDevicesToFilterDialog(Dialog dialog)
        {
            var layout = dialog.FindViewById<LinearLayout> (Resource.Id.SelectDeviceLayout);
            foreach (Device dev in UserDevices) {
                ToggleButton listItem = CreateDeviceSelectionItem (dev);

                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                layoutParams.SetMargins (5, 5, 5, 5);
                layoutParams.Height = 100;

                layout.AddView (listItem, layoutParams);
            }
        }
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:14,代码来源:NotificationsActivity.cs

示例4: MultiItemRowListAdapter

        public MultiItemRowListAdapter(Context context, IListAdapter adapter, int itemsPerRow, int cellSpacing, bool canClickAtRow = false)
        {
            if (itemsPerRow <= 0) {
                throw new IllegalArgumentException("Number of items per row must be positive");
                }
                _contextReference = new WeakReference<Context>(context);
                _adapter = adapter;
                _itemsPerRow = itemsPerRow;
                _cellSpacing = cellSpacing;
            _canClickAtRow = canClickAtRow;

            _itemLayoutParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent);
                _itemLayoutParams.SetMargins(cellSpacing, cellSpacing, 0, 0);
                _itemLayoutParams.Weight = 1;
                _rowLayoutParams = new AbsListView.LayoutParams(AbsListView.LayoutParams.MatchParent, AbsListView.LayoutParams.WrapContent);
        }
开发者ID:okrotowa,项目名称:Yorsh,代码行数:16,代码来源:MultiItemRowListAdapter.cs

示例5: GetCustomTabView

        public View GetCustomTabView(ViewGroup p0, int p1)
        {
            var header = new LinearLayout(p0.Context);
            header.Orientation = Orientation.Vertical;
            var model = _pages[p1];
            var parameter = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Center
            };

            parameter.SetMargins(0,3,0,3);
            View viewUpper;
            TextView viewBottom = new TextView(p0.Context) {LayoutParameters = parameter};
            viewBottom.SetTextColor(new Color(ResourceExtension.BrushText));
            if (model is CalendarSummaryPivotPage)
            {
                var img = new ImageView(p0.Context) {LayoutParameters = new LinearLayout.LayoutParams(-2,-2) {Gravity = GravityFlags.Center} };
                img.ScaleX = .7f;
                img.ScaleY = .7f;
                img.SetImageDrawable(p0.Context.Resources.GetDrawable(Resource.Drawable.icon_list));
                viewUpper = img;
                viewBottom.Text = "Summary";
                (viewBottom.LayoutParameters as LinearLayout.LayoutParams).SetMargins(0,4,0,0);
            }
            else
            {
                var txt = new TextView(p0.Context) { LayoutParameters = parameter };
                txt.Text = model.Header;
                txt.SetTextColor(new Color(ResourceExtension.BrushText));
                txt.SetTextSize(ComplexUnitType.Sp, 18);
                viewBottom.Text = model.Sub;
                viewUpper = txt;
            }
            header.AddView(viewUpper);
            header.AddView(viewBottom);
            return header;
        }
开发者ID:Mordonus,项目名称:MALClient,代码行数:39,代码来源:CalendarPagerAdapter.cs

示例6: addActionItemCompatFromMenuItem

        /**
         * Adds an action button to the compatibility action bar, using menu information from a {@link
         * android.view.IMenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's
         * state can be changed to show a loading spinner using
         * {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(bool)}.
         */
        private View addActionItemCompatFromMenuItem(IMenuItem item)
        {
            int itemId = item.ItemId;

            ViewGroup actionBar = getActionBarCompat();
            if (actionBar == null) {
                return null;
            }

            // Create the button
            ImageButton actionButton = new ImageButton(mActivity, null,
                    itemId == Resource.Id.home
                            ? Resource.attr.actionbarCompatItemHomeStyle
                            : Resource.attr.actionbarCompatItemStyle);
            actionButton.LayoutParameters = (new ViewGroup.LayoutParams(
                    (int) mActivity.getResources().getDimension(
                            itemId == android.Resource.Id.home
                                    ? Resource.dimen.actionbar_compat_button_home_width
                                    : Resource.dimen.actionbar_compat_button_width),
                    ViewGroup.LayoutParams.FILL_PARENT));
            if (itemId == Resource.Id.menuSync) {
                actionButton.Id = Resource.Id.actionbar_compat_item_refresh;
            }
            actionButton.SetImageDrawable(item.Icon);
            actionButton.SetScaleType(ImageView.ScaleType.Center);
            actionButton.ContentDescription = item.TitleFormatted;
            //	        actionButton.setOnClickListener(new View.OnClickListener() {
            //	            public void onClick(View view) {
            //	                mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item);
            //	            }
            //	        });

            actionBar.AddView(actionButton);

            if (item.ItemId == Resource.Id.menuSync) {
                // Refresh buttons should be stateful, and allow for indeterminate progress indicators,
                // so add those.
                ProgressBar indicator = new ProgressBar(mActivity, null,
                        Resource.attr.actionbarCompatProgressIndicatorStyle);

                int buttonWidth = mActivity.Resources.GetDimensionPixelSize(
                        Resource.dimen.actionbar_compat_button_width);
                int buttonHeight = mActivity.Resources.GetDimensionPixelSize(
                        Resource.dimen.actionbar_compat_height);
                int progressIndicatorWidth = buttonWidth / 2;

                LinearLayout.LayoutParams indicatorLayoutParams = new LinearLayout.LayoutParams(
                        progressIndicatorWidth, progressIndicatorWidth);
                indicatorLayoutParams.SetMargins(
                        (buttonWidth - progressIndicatorWidth) / 2,
                        (buttonHeight - progressIndicatorWidth) / 2,
                        (buttonWidth - progressIndicatorWidth) / 2,
                        0);
                indicator.LayoutParameters = indicatorLayoutParams;
                indicator.Visibility = ViewStates.Gone;
                indicator.Id = Resource.Id.actionbar_compat_item_refresh_progress;
                actionBar.AddView(indicator);
            }

            return actionButton;
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:67,代码来源:ActionBarHelperBase.cs

示例7: AddEventToDialog

 private void AddEventToDialog(Dialog dialog)
 {
     var layout = dialog.FindViewById<LinearLayout> (Resource.Id.SelectDeviceLayout);
     foreach (Event eve in TowManager.Get(1)) {
         Button listItem = CreateEventItem (eve);
         LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
             LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
         layoutParams.SetMargins (5, 5, 5, 5);
         layoutParams.Height = 100;
         layout.AddView (listItem, layoutParams);
     }
 }
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:12,代码来源:MainMenuActivity.cs

示例8: GetPropertyWindowLayout

		public override View GetPropertyWindowLayout (Context context)
		{
			int width = (context.Resources.DisplayMetrics.WidthPixels) / 2;
			propertylayout = new LinearLayout(context);
			propertylayout.Orientation = Orientation.Vertical;

			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				width * 2, 3);

			layoutParams.SetMargins(0, 20, 0, 0);

			TextView culture = new TextView(context);
			culture.TextSize=20;
			culture.Text="Position";

			positionSpinner = new Spinner(context);
			positionSpinner.SetGravity(GravityFlags.Left);


			List<String> list = new List<String>();

			list.Add("Left");
			list.Add("Right");
			list.Add("Top");
			list.Add("Bottom");


			dataAdapter = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);


			positionSpinner.Adapter = dataAdapter;
			positionSpinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem= dataAdapter.GetItem(e.Position);
				if (selectedItem.Equals("Left")) {
					sliderposition = Position.Left;
				}
				if (selectedItem.Equals("Right")) {
					sliderposition = Position.Right;
				}
				if (selectedItem.Equals("Top")) {
					sliderposition = Position.Top;
				}
				if (selectedItem.Equals("Bottom")) {
					sliderposition = Position.Bottom;
				}
			};

			propertylayout.AddView(culture);
			propertylayout.AddView(positionSpinner);

			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.separatorColor = Color.LightGray;
			separate.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 3);
			propertylayout.AddView(separate, layoutParams);

			TextView culture2 = new TextView(context);
			culture2.TextSize=20;
			culture2.Text="Animations";

			animationSpinner = new Spinner(context);

			animationSpinner.SetGravity(GravityFlags.Left);


			List<String> list2 = new List<String>();

			list2.Add("SlideOnTop");
			list2.Add("Reveal");
			list2.Add("Push");



			dataAdapter1 = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem, list2);

			dataAdapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);;

			animationSpinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem= dataAdapter1.GetItem(e.Position);
				if (selectedItem.Equals("SlideOnTop")) {
					sliderTransition = Transition.SlideOnTop;
				}
				if (selectedItem.Equals("Reveal")) {
					sliderTransition =Transition.Reveal;
				}
				if (selectedItem.Equals("Push")) {
					sliderTransition =Transition.Push;
				}
			};

			animationSpinner.Adapter = dataAdapter1;
			propertylayout.AddView(culture2);
			propertylayout.AddView(animationSpinner);

			SeparatorView separate2 = new SeparatorView(context, width * 2);
			separate2.separatorColor = Color.LightGray;
			separate2.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 3);
			propertylayout.AddView(separate2, layoutParams);
//.........这里部分代码省略.........
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:101,代码来源:NavigationDrawer.cs

示例9: GetPropertyWindowLayout

		public override View GetPropertyWindowLayout (Android.Content.Context context)
		{
			int width = context.Resources.DisplayMetrics.WidthPixels / 2;
			propertylayout = new LinearLayout(context);
			propertylayout.Orientation = Orientation.Vertical;
			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParams.SetMargins(0, 20, 0, 0);
			//SuggestionMode
			TextView textView1 = new TextView(context);
			textView1.Text = "Suggestion Mode";
			textView1.TextSize=20;
			textView1.Gravity  = GravityFlags.Left;
			TextView textview2 = new TextView(context);
			propertylayout.AddView(textview2);
			spinner1 = new Spinner(context);
			//spinner1.Gravity  = GravityFlags.Left;
			propertylayout.AddView(textView1);
			propertylayout.AddView(spinner1);
			List<String> list = new List<String>();
			list.Add("StartsWith");
			list.Add("StartsWithCaseSensitive");
			list.Add("Contains");
			list.Add("ContainsWithCaseSensitive");
			list.Add("EndsWith");
			list.Add("EndsWithCaseSensitive");
			list.Add("Equals");
			list.Add("EqualsWithCaseSensitive");
			//list.add("None");

			dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			spinner1.Adapter = dataAdapter;

			spinner1.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem (e.Position);
				
				if (selectedItem.Equals ("StartsWith")) {
					suggestionModes = SuggestionMode.StartsWith;
									
				} else if (selectedItem.Equals ("StartsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.StartsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Contains")) {
					suggestionModes = SuggestionMode.Contains;
									
				} else if (selectedItem.Equals ("ContainsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("EndsWith")) {
					suggestionModes = SuggestionMode.EndsWith;
										
				} else if (selectedItem.Equals ("EndsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EndsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Equals")) {
					suggestionModes = SuggestionMode.Equals;
										
				} else if (selectedItem.Equals ("EqualsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
										
				}
			};
			//Separator 1
			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParam1 = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParam1.SetMargins(0, 20, 0, 0);
			propertylayout.AddView(separate,layoutParam1);

			//AutoCompleteMode
			TextView textV1 = new TextView(context);
			textV1.Text = "AutoComplete Mode";
			textV1.TextSize=20;
			textV1.Gravity = GravityFlags.Left;
			TextView textv2 = new TextView(context);
			propertylayout.AddView(textv2);
			text3 = new Spinner(context);
			propertylayout.AddView(textV1);
			propertylayout.AddView(text3);
			List<String> list1 = new List<String>();
			list1.Add("Suggest");
			list1.Add("SuggestAppend");
			list1.Add("Append");

			dataadapter1 = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list1);
			dataadapter1.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			text3.Adapter = dataadapter1;

			text3.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataadapter1.GetItem(e.Position);
									if (selectedItem.Equals("Suggest")) {
										autoCompleteMode = AutoCompleteMode.Suggest;
										
									} else if (selectedItem.Equals("SuggestAppend")) {
										autoCompleteMode = AutoCompleteMode.SuggestAppend;
										
//.........这里部分代码省略.........
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:101,代码来源:AutoComplete.cs

示例10: createTransition

        private LinearLayout createTransition()
        {
            LinearLayout drawerView = new LinearLayout (context);
            drawerView.Orientation = Orientation.Horizontal;
            drawerView.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);

            ImageView fadeIn = new ImageView (context);
            LinearLayout.LayoutParams viewPars;
            viewPars = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (20f, context));
            viewPars.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
            fadeIn.LayoutParameters = viewPars;
            fadeIn.Tag = 1;
            fadeIn.Click += new EventHandler (transition_Selected);
            fadeIn.SetImageResource (Resource.Drawable.fadingin);

            ImageView fadeOut = new ImageView (context);
            fadeOut.LayoutParameters = viewPars;
            fadeOut.Tag = 2;
            fadeOut.Click += new EventHandler (transition_Selected);
            fadeOut.SetImageResource (Resource.Drawable.fadingout);

            ImageView rotate = new ImageView (context);
            rotate.LayoutParameters = viewPars;
            rotate.Tag = 3;
            rotate.Click += new EventHandler (transition_Selected);
            rotate.SetImageResource (Resource.Drawable.wheel);

            ImageView move = new ImageView (context);
            move.LayoutParameters = viewPars;
            move.Tag = 4;
            move.Click += new EventHandler (transition_Selected);
            move.SetImageResource (Resource.Drawable.barndoors);

            drawerView.AddView (fadeIn);
            drawerView.AddView (fadeOut);
            drawerView.AddView (rotate);
            drawerView.AddView (move);

            return drawerView;
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:40,代码来源:CreateAnimationActivityDesigner.cs

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

示例12: OnCreateView


//.........这里部分代码省略.........
            //				}
            //				else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //					nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //				}
            //				else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //					nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //				}

            };
            relativelayout.AddView (noeventcard);
            //tutorial card
            RelativeLayout tutorialcard = new RelativeLayout(nn_activity);
            RelativeLayout.LayoutParams tutorialcardparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcardparam.AddRule (LayoutRules.Below,noeventcard.Id);
            tutorialcardparam.TopMargin = TapUtil.dptodx(10);
            tutorialcard.LayoutParameters=tutorialcardparam;
            tutorialcard.Id = TapUtil.generateViewId ();
            tutorialcard.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
            tutorialcard.SetPadding(TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20));

            //tutorial label
            TextView tutoriallabel =new TextView(nn_activity);
            var tutorialparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutoriallabel.LayoutParameters = tutorialparam;
            tutoriallabel.Gravity = GravityFlags.CenterHorizontal;
            tutoriallabel.Text=AboutScreenData.TutorialLabel;
            tutoriallabel.TextSize=TapUtil.dptodx(6);
            tutoriallabel.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            tutoriallabel.Id = TapUtil.generateViewId ();

            LinearLayout tutorialcontainer = new LinearLayout (nn_activity);
            var tutorialcontainerparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcontainerparam.AddRule (LayoutRules.Below, tutoriallabel.Id);
            tutorialcontainerparam.SetMargins (0, TapUtil.dptodx (5), 0, 0);
            tutorialcontainer.LayoutParameters = tutorialcontainerparam;
            tutorialcontainer.Orientation = global::Android.Widget.Orientation.Vertical;

            var tutorialitemparam=new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialitemparam.SetMargins (0,TapUtil.dptodx(15),0,0);
            tutorialitemparam.Gravity = GravityFlags.Center;

            TextView tutorial0label=new TextView(nn_activity);
            tutorial0label.Text=AboutScreenData.Tutorial0Label;
            tutorial0label.LayoutParameters = tutorialitemparam;
            tutorial0label.Gravity = GravityFlags.CenterHorizontal;
            tutorial0label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial0label.Tag = 0;
            tutorial0label.Click-=OnShowTutorialTextClick;
            tutorial0label.Click+=OnShowTutorialTextClick;

            TextView tutorial1label=new TextView(nn_activity);
            tutorial1label.Text=AboutScreenData.Tutorial1Label;
            tutorial1label.LayoutParameters = tutorialitemparam;
            tutorial1label.Gravity = GravityFlags.CenterHorizontal;
            tutorial1label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial1label.Tag = 1;
            tutorial1label.Click-=OnShowTutorialTextClick;
            tutorial1label.Click+=OnShowTutorialTextClick;

            TextView tutorial2label=new TextView(nn_activity);
            tutorial2label.Text=AboutScreenData.Tutorial2Label;
            tutorial2label.LayoutParameters = tutorialitemparam;
            tutorial2label.Gravity = GravityFlags.CenterHorizontal;
            tutorial2label.Tag = 2;
            tutorial2label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial2label.Click-=OnShowTutorialTextClick;
开发者ID:MADMUC,项目名称:TAP5050,代码行数:67,代码来源:AboutFragment.cs

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

示例14: CreateLPs

		/// <summary>
		/// Sets the layout parameters of the object
		/// </summary>
		private void CreateLPs ()
		{
			LinearLayout.LayoutParams lllp = new 
				LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
			lllp.SetMargins (5, 5, 5, 5);
			this.LayoutParameters = lllp;
		}
开发者ID:aliarobinson,项目名称:SpeedyChef_375,代码行数:10,代码来源:MealDesign.cs

示例15: GetPropertyWindowLayout

		public override View GetPropertyWindowLayout (Context context)
		{
			/**
		 * Property Window
		 * */
			int width = (context.Resources.DisplayMetrics.WidthPixels) / 2;
			propertylayout = new LinearLayout(context); //= new LinearLayout(context);
			propertylayout.Orientation=Orientation.Vertical;

			LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
				width * 2, 5);

			layoutParams1.SetMargins(0, 20, 0, 0);

			TextView culturetxt = new TextView(context);
			culturetxt.TextSize=20;
			culturetxt.Text="Culture";

			cultureSpinner = new Spinner(context);
			//cultureSpinner.Gravity=GravityFlags.Left;


			List<String> list = new List<String>();

			list.Add("United States");
			list.Add("United Kingdom");
			list.Add("Japan");
			list.Add("France");
			list.Add("Italy");


			dataAdapter = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource
			(Android.Resource.Layout.SimpleSpinnerDropDownItem);

			cultureSpinner.Adapter = dataAdapter;

			cultureSpinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem(e.Position);

				if (selectedItem.Equals("United States")) {
					localinfo=Java.Util.Locale.Us; //new Java.Util.Locale("en","US");
				}
				if (selectedItem.Equals("United Kingdom")) {
					localinfo=Java.Util.Locale.Uk;
										
				}
				if (selectedItem.Equals("Japan")) {
					localinfo=Java.Util.Locale.Japan;
				}
				if (selectedItem.Equals("France")) {
					localinfo=Java.Util.Locale.France;
				}
				if (selectedItem.Equals("Italy")) {
					localinfo=Java.Util.Locale.Italy;
				}

			};
			propertylayout.AddView(culturetxt);
			propertylayout.AddView(cultureSpinner);

			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 5);
			propertylayout.AddView(separate, layoutParams1);

			TextView textView6 = new TextView(context);
			textView6.Text="Allow Null";
			textView6.Gravity=GravityFlags.Center;
			textView6.TextSize=20;

			Switch checkBox = new Switch(context);
			checkBox.Checked=true;
			checkBox.CheckedChange+= (object send, CompoundButton.CheckedChangeEventArgs eve) => {
				if(!eve.IsChecked)
					allownull = false;
				else
					allownull = true;
			};

			LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams3.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams4.SetMargins(0, 10, 0, 0);
			stackView3 = new LinearLayout(context);
			stackView3.AddView(textView6,layoutParams4);
			stackView3.AddView(checkBox, layoutParams3);
			stackView3.Orientation=Orientation.Horizontal;
			propertylayout.AddView(stackView3);
			SeparatorView separate3 = new SeparatorView(context, width * 2);
			separate3.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams5.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate3, layoutParams5);
			propertylayout.SetPadding(20,20,20,20);
			
			return  propertylayout;
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:100,代码来源:NumericTextBox.cs


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