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


C# LinearLayout.SetGravity方法代码示例

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


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

示例1: OnElementChanged

        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            var actionBar = ((Activity)Context).ActionBar;
            LinearLayout layout = new LinearLayout(Context);
            layout.Orientation = Orientation.Horizontal;
            layout.WeightSum = Width;
            layout.SetGravity(GravityFlags.Left);
            TextView title = new TextView(Context);
            title.Text = actionBar.Title;

            title.TextSize = 18;
            Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "BTrafcBd.ttf");
            title.Typeface = font;

            LayoutParams textlp = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);

            ImageView logo = new ImageView(Context);

            logo.Clickable = true;
            logo.Click += Logo_Click;

            logo.SetImageResource(Resource.Drawable.Logo);
            logo.SetScaleType(ImageView.ScaleType.FitStart);
            layout.AddView(logo);
            actionBar.SetCustomView(layout, new ActionBar.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent));
            actionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom, ActionBarDisplayOptions.ShowCustom);
        }
开发者ID:mxmaa64,项目名称:Calender,代码行数:29,代码来源:MyMasterDetailPageRenderer.cs

示例2: Initialize

		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);

			txtTitle = new TextView (context);
			background = new LinearLayout (context);
			linearTitle = new LinearLayout (context);
			linearButton = new LinearLayout (context);
			imgPlay = new ImageButton (context);
			video = new VideoView (context);

			image.SetGravity (GravityFlags.Bottom);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (111));
			background.Orientation = Orientation.Horizontal;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			linearTitle.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (482), Configuration.getHeight (111));
			linearTitle.Orientation = Orientation.Horizontal;
			linearTitle.SetGravity (GravityFlags.Center);

			linearButton.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (100), Configuration.getHeight (111));
			linearButton.Orientation = Orientation.Horizontal;
			linearButton.SetGravity (GravityFlags.Center);


			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			//image.SetGravity (GravityFlags.Bottom);
			video.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(582),Configuration.getHeight(394));


			imgPlay.Alpha = 255.0f;
			imgPlay.SetBackgroundColor (Color.Transparent);

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtTitle.SetPadding (Configuration.getWidth (20), 0, 0, 0);
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtTitle.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
			txtTitle.SetMaxLines (2);

			//imgPlay.SetImageBitmap (Bitmap.CreateStxtcaledBitmap (getBitmapFromAsset ("icons/"), Configuration.getWidth (83), Configuration.getHeight (83), true));
			linearTitle.AddView (txtTitle);
			linearButton.AddView (imgPlay);

			background.AddView (linearTitle);
			background.AddView (linearButton);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:59,代码来源:CustomerVideoView.cs

示例3: OnCreateView

        //@Override
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            TextView text = new TextView(this.Activity);
            text.Gravity = GravityFlags.Center;
            text.Text = mContent;
            text.TextSize = 20 * this.Resources.DisplayMetrics.Density;
            text.SetPadding(20, 20, 20, 20);

            LinearLayout layout = new LinearLayout(this.Activity);
            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            layout.SetGravity(GravityFlags.Center);
            layout.AddView(text);

            return layout;
        }
开发者ID:skywolf888,项目名称:ViewPagerIndicator.Net,代码行数:16,代码来源:TestFragment.cs

示例4: OnElementChanged

        protected override void OnElementChanged ( ElementChangedEventArgs <CarouselPage> e ) {
            base.OnElementChanged ( e );

            if ( viewPager != null ) {
                if ( viewPager.Adapter != null ) {
                    viewPager.Adapter.Dispose ();
                    viewPager.Adapter = null;
                }
                RemoveView ( viewPager );
                viewPager.SetOnPageChangeListener ( null );
                viewPager.Dispose ();
            }

            if ( indicator != null ) {
                RemoveView ( indicator );
                indicator.SetOnPageChangeListener ( null );
                indicator.Dispose ();
            }

            if ( linearLayout != null ) {
                RemoveView ( linearLayout );
                linearLayout.Dispose ();
            }

            RemoveAllViews ();

            linearLayout = new LinearLayout ( Forms.Context );
            linearLayout.SetGravity ( GravityFlags.Center );
            linearLayout.Orientation = Orientation.Vertical;
            linearLayout.LayoutParameters = new LayoutParams ( LayoutParams.MatchParent , LayoutParams.MatchParent );
            linearLayout.Focusable = true;
            linearLayout.Clickable = true;
            AddView ( linearLayout );

            viewPager = new ViewPager ( Context ) {
                    OffscreenPageLimit = int.MaxValue
            };

            //the following is needed to draw indicator based on the exisitng theme.
            var contextThemeWrapper = new ContextThemeWrapper ( Context , Resource.Style.Theme_PageIndicatorDefaults );
            indicator = new TabCarouselPageIndicator ( contextThemeWrapper , Element );

            linearLayout.AddView ( indicator , new LayoutParams ( LayoutParams.MatchParent , LayoutParams.WrapContent ) );
            linearLayout.AddView ( viewPager , new LinearLayout.LayoutParams ( LayoutParams.MatchParent , 0 , 1.0f ) );

        }
开发者ID:ShahmanTeh,项目名称:Xamarin.Forms-TabCarouselPage,代码行数:46,代码来源:TabCarouselPageRenderer.cs

示例5: Initialize

		void Initialize ()
		{

			this.LayoutParameters = new RelativeLayout.LayoutParams (-1,-2);
			this.SetGravity (GravityFlags.Center);

			linearAll = new LinearLayout (context);
			linearTextContainer= new LinearLayout (context);
			linearBarra = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtPhrase = new TextView (context);
			imgBarra = new ImageView (context);
			imgComilla = new ImageView (context);

			linearAll.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
			linearTextContainer.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(552),-2);
			linearBarra.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(30),-2);

			linearAll.Orientation = Orientation.Horizontal;
			linearBarra.Orientation = Orientation.Vertical;
			linearTextContainer.Orientation = Orientation.Vertical;

			linearAll.SetGravity (GravityFlags.Center);
			//linearBarra.SetGravity (GravityFlags.CenterHorizontal);
			linearTextContainer.SetGravity (GravityFlags.CenterVertical);

			//txtPhrase.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			//txtAuthor.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (30));

			txtPhrase.SetTextSize (ComplexUnitType.Dip, 21.0f);
			txtAuthor.SetTextSize(ComplexUnitType.Dip, 16.0f);

			txtAuthor.SetTextColor (Color.ParseColor("#b0afb5"));

			linearBarra.AddView (imgComilla);
			//linearBarra.AddView (imgBarra);
			linearTextContainer.AddView (txtPhrase);
			linearTextContainer.AddView (txtAuthor);

			linearAll.AddView (linearBarra);
			linearAll.AddView (linearTextContainer);

			this.AddView (linearAll);

		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:46,代码来源:PhraseView.cs

示例6: CreateView

        protected override View CreateView(LayoutInflater inflater, ViewGroup container)
        {
            LinearLayout rootView = new LinearLayout(Activity)
            {
                Orientation = Orientation.Vertical,
            };
            rootView.SetGravity(GravityFlags.Center);
            rootView.SetPaddingRelative(16, 10, 16, 10);

            _pickerView = new ColorPickerView(Activity);
            _oldPanelView = new ColorPanelView(Activity);
            _currentPanelView = new ColorPanelView(Activity);

            TextView textView = new TextView(Activity)
            {
                Text = "→",
                TextSize = 40,
                Gravity = GravityFlags.Center
            };
            textView.SetTextColor(Color.White);
            textView.SetPadding(10, 1, 10, 1);
            float density = Application.Context.Resources.DisplayMetrics.Density;

            LinearLayout bottomView = new LinearLayout(Activity)
            {
                Orientation = Orientation.Horizontal
            };
            LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 0.5f);

            rootView.AddView(_pickerView);
            LinearLayout.LayoutParams rootLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int) (density*40));
            rootLayoutParams.SetMargins(10, 10, 10, 10);
            rootView.AddView(bottomView, rootLayoutParams);

            bottomView.AddView(_oldPanelView, layoutparams);
            bottomView.AddView(textView);
            bottomView.AddView(_currentPanelView, layoutparams);

            //setting up colors
            _pickerView.OnColorChanged += OnPickerColorChanged;

            _oldPanelView.Color = OldColor;
            _pickerView.setColor((int)OldColor, true);

            return rootView;
        }
开发者ID:snipervld,项目名称:StormXamarin,代码行数:46,代码来源:ColorPickerDialog.cs

示例7: GetSampleContent

		public override View GetSampleContent (Context con)
		{
			int height = con.Resources.DisplayMetrics.HeightPixels/2;

			LinearLayout linearLayout = new LinearLayout(con);
			linearLayout.SetGravity (Android.Views.GravityFlags.CenterHorizontal);
			linearLayout.Orientation = Android.Widget.Orientation.Vertical;
			linearLayout.SetBackgroundColor(Color.White);
			img = new ImageView(con);
			img.SetImageResource (Resource.Drawable.mount);
			linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
			linearLayout.SetPadding(20, 20, 20, 20);
			FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height+(height/3.5)),GravityFlags.Center);
			img.SetPadding(12, 0, 10, 0);
			img.LayoutParameters = (layoutParams);


			range=new SfRangeSlider(con);
			range.Minimum = 0;range.Maximum = 100; range.Value = 100;
			range.ShowRange = false; range.SnapsTo = SnapsTo.None;
			range.Orientation = Com.Syncfusion.Sfrangeslider.Orientation.Horizontal;
			range.TickPlacement = TickPlacement.BottomRight;
			range.ShowValueLabel = true; range.TickFrequency = 20;
			range.ValuePlacement = ValuePlacement.BottomRight;
			range.LayoutParameters = (new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150));
			range.ValueChanged += ValueChanged ;
				
			linearLayout.AddView(img);

			TextView text1 = new TextView(con);
			text1.Text = "  Opacity";
			text1.TextSize=20;
			text1.Gravity = GravityFlags.Left;
			range.SetY(-30);
			linearLayout.AddView(text1);
			linearLayout.AddView(range);

			FrameLayout frame = new FrameLayout(con);
			frame.SetBackgroundColor (Color.White);
			frame.LayoutParameters = ( new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent,GravityFlags.Center));
			frame.AddView(linearLayout);

			return frame;
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:44,代码来源:Slider.cs

示例8: initHeaderBar

		private LinearLayout initHeaderBar(string title)
		{
			LinearLayout barlayout = new LinearLayout (this.context);
			LinearLayout.LayoutParams blp = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent, 0.0F);
			barlayout.LayoutParameters = blp;
			barlayout.SetGravity (GravityFlags.CenterHorizontal | GravityFlags.CenterVertical);
			barlayout.SetBackgroundColor (Color.Black);

			TextView text = new TextView (this.context);
			if (!title.Equals ("undefined")) {
				text.Text = title;
			}
			text.SetTextColor (Color.White);
			text.Gravity = GravityFlags.CenterHorizontal | GravityFlags.CenterVertical;
			text.TextSize = 20F;
			text.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1.0F);
			barlayout.AddView (text);
			return barlayout;
		}
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:19,代码来源:FHOAuthWebview.cs

示例9: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			if ((savedInstanceState != null) && savedInstanceState.ContainsKey (KEY_CONTENT)) {
				mContent = savedInstanceState.GetString (KEY_CONTENT);
			}
	
			TextView text = new TextView (Activity);
			text.Gravity = GravityFlags.Center;
			text.Text = mContent;
			text.TextSize = (20 * Resources.DisplayMetrics.Density);
			text.SetPadding (20, 20, 20, 20);
	
			LinearLayout layout = new LinearLayout (Activity);
			layout.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
			layout.SetGravity (GravityFlags.Center);
			layout.AddView (text);
	
			return layout;
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:19,代码来源:TestFragment.cs

示例10: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // full screen & full brightness
            this.RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
            mWL = ((PowerManager)GetSystemService(Context.PowerService)).NewWakeLock(WakeLockFlags.Full, "BOB");
            mWL.Acquire();
            mView = new MainView(this);
            SetContentView(mView);
            LinearLayout ll = new LinearLayout(this);
            Button b = new Button(this);
            b.SetText("Hello", TextView.BufferType.Normal);
            ll.AddView(b);
            ll.SetGravity(GravityFlags.CenterHorizontal | GravityFlags.CenterVertical);
            this.AddContentView(ll,
                new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent));
        }
开发者ID:jggriffiths,项目名称:XamarinCameraTest,代码行数:20,代码来源:MainActivity.cs

示例11: GetSampleContent

        public override Android.Views.View GetSampleContent(Context context)
        {
            sfGrid = new SfDataGrid(context);
            viewModel = new ExportingViewModel();
            sfGrid.AutoGeneratingColumn += GridGenerateColumns;
            sfGrid.ItemsSource = (viewModel.OrdersInfo);
            exportPdf = new ImageButton(context);
            exportPdf.SetMaxHeight(30);
            exportPdf.SetMaxWidth(30);
            exportPdf.SetBackgroundColor(Android.Graphics.Color.Transparent); 
            exportPdf.SetImageResource(Resource.Drawable.pdfexport);
            exportPdf.SetScaleType(ImageView.ScaleType.FitXy);
            exportPdf.LayoutParameters = new ViewGroup.LayoutParams( 120,120);
            exportPdf.Click += ExportToPdf;
            exportExcel = new ImageButton(context);
            exportExcel.SetMaxHeight(30);
            exportExcel.SetMaxWidth(30);
            exportExcel.SetBackgroundColor(Android.Graphics.Color.Transparent);
            exportExcel.SetImageResource(Resource.Drawable.excelexport);
            exportExcel.SetScaleType(ImageView.ScaleType.FitXy);
            exportExcel.LayoutParameters = new ViewGroup.LayoutParams(120, 120);
            exportExcel.Click += ExportToExcel;

            LinearLayout option = new LinearLayout(context);
            option.SetGravity(GravityFlags.Center);
            option.Orientation = Android.Widget.Orientation.Horizontal;
            var pdftext = new TextView(context) { Text = "Export to Pdf" };
            pdftext.SetTypeface(null, TypefaceStyle.Bold);
            var exceltext = new TextView(context) { Text = "Export to Excel" };
            exceltext.SetTypeface(null, TypefaceStyle.Bold);
            option.AddView(exportPdf);         
            option.AddView(pdftext);
            option.AddView(exportExcel);
            option.AddView(exceltext);
            
            LinearLayout mainView = new LinearLayout(context);
            mainView.Orientation = Android.Widget.Orientation.Vertical;
            mainView.AddView(option);
            mainView.AddView(sfGrid);
            return mainView;
        }
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:41,代码来源:Exporting.cs

示例12: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var text = new TextView(Activity)
                {
                    Gravity = GravityFlags.Center,
                    Text = _content,
                    TextSize = 20 * Resources.DisplayMetrics.Density
                };
            text.SetPadding(20, 20, 20, 20);

            var layout = new LinearLayout(Activity)
                {
                    LayoutParameters =
                        new ViewGroup.LayoutParams(
                            ViewGroup.LayoutParams.FillParent,
                            ViewGroup.LayoutParams.FillParent)
                };
            layout.SetGravity(GravityFlags.Center);
            layout.AddView(text);

            return layout;
        }
开发者ID:jamesmontemagno,项目名称:ViewPagerIndicator,代码行数:22,代码来源:TestFragment.cs

示例13: propogateVideoListView

        private void propogateVideoListView(List<VideoAlbumInfo> videoAlbums)
        {
            RunOnUiThread (delegate {
                if (videoAlbums.Count != 0) {
                    for (int n = 0; n < videoAlbums.Count; ++n) {
                        using (LinearLayout layout = new LinearLayout (context)) {
                            layout.Orientation = Android.Widget.Orientation.Horizontal;
                            layout.SetGravity (GravityFlags.Center);
                            layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                            using (ImageView profilepic = new ImageView (context)) {
                                profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (40f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                                profilepic.Tag = new Java.Lang.String ("thumbpic_" + n.ToString ());
                                layout.AddView (profilepic);
                            }
                            using (TextView text = new TextView (context)) {
                                text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (235f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                                text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                text.Gravity = GravityFlags.CenterVertical;
                                text.TextSize = 16f;
                                text.SetTextColor (Android.Graphics.Color.White);
                                text.Text = videoAlbums [n].Description;
                                layout.AddView (text);
                            }
                            using (ImageView checkbox = new ImageView (context)) {
                                checkbox.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.checkbox));
                                checkbox.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (25f, context), (int)ImageHelper.convertDpToPixel (25f, context));
                                //checkbox.ContentDescription = CHECKBOX_UNCHECKED;

                                int contactId = new int ();
                                contactId = n;
                                layout.Clickable = true;
                                layout.Click += (object s, EventArgs e) => {
                                    handleVideoClick (videoAlbums [n]); };
                                layout.AddView (checkbox);
                            }
                            this.listWrapper.AddView (layout);
                        }
                    }
                }

                RunOnUiThread (() => DismissLightboxDialog ());
            });
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:44,代码来源:GetPhotoAlbumActivity.cs

示例14: propogatePhotoListView

        private void propogatePhotoListView(List<PhotoAlbumInfo> photoAlbums)
        {
            RunOnUiThread (delegate {
                if (photoAlbums.Count != 0) {
                    for (int n = 0; n < photoAlbums.Count; ++n) {
                        using (LinearLayout layout = new LinearLayout (context)) {
                            layout.Orientation = Android.Widget.Orientation.Horizontal;
                            layout.SetGravity (GravityFlags.Center);
                            layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                            using (TextView text = new TextView (context)) {
                                text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (235f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                                text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                text.Gravity = GravityFlags.CenterVertical;
                                text.TextSize = 16f;
                                text.SetTextColor (Android.Graphics.Color.White);
                                text.Text = photoAlbums [n].Name;
                                int contactId = new int ();
                                contactId = n;
                                layout.Clickable = true;
                                layout.Click += (object s, EventArgs e) => {
                                    handleClick (photoAlbums [contactId]);
                                    #if DEBUG
                                    Console.WriteLine ("control returned");
            #endif
                                };
                                layout.AddView (text);
                            }
                            listWrapper.AddView (layout);
                        }
                    }
                }

                RunOnUiThread (() => DismissLightboxDialog ());
            });
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:36,代码来源:GetPhotoAlbumActivity.cs

示例15: Initialize

		void Initialize ()
		{

			var metrics = Resources.DisplayMetrics;
			widthInDp = ((int)metrics.WidthPixels);
			heightInDp = ((int)metrics.HeightPixels);
			Configuration.setWidthPixel (widthInDp);
			Configuration.setHeigthPixel (heightInDp);

			this.SetBackgroundColor (Color.ParseColor ("#000000"));


			linearContainerFisrst = new LinearLayout (context);
			//linearContainer = new LinearLayout (context);
			linearImageLO = new LinearLayout (context);
			linearTextLO = new LinearLayout (context);
			linearLike = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtChapter= new TextView (context);
			txtNameLO = new TextView (context);
			txtLike = new TextView (context);



			imgHeart= new ImageView (context);

			this.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(637));


			linearContainerFisrst.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			linearImageLO.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(637));
			linearTextLO.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(250));
			linearLike.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(120), Configuration.getHeight(80));


			//Drawable drBack =new BitmapDrawable(Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondocondiagonalm.png"), 640, 1136, true));
			//linearContainerFisrst.SetBackgroundDrawable (drBack);
			//drBack = null;


			linearTextLO.Orientation = Orientation.Vertical;
			linearTextLO.SetGravity(GravityFlags.Right);

			linearLike.Orientation = Orientation.Vertical;
			linearLike.SetGravity (GravityFlags.Center);



			linearContainerFisrst.Orientation = Orientation.Vertical;



			//Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 480, 640, true));
			//linearImageLO.SetBackgroundDrawable (d);

			//imgHeart.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/like.png"), Configuration.getWidth(43), Configuration.getHeight(43), true));



			txtNameLO.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtChapter.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (50));
			txtAuthor.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtNameLO.Typeface = Typeface.DefaultBold;


			txtAuthor.SetTextColor (Color.ParseColor("#ffffff"));
			txtChapter.SetTextColor (Color.ParseColor("#ffffff"));
			txtNameLO.SetTextColor (Color.ParseColor("#ffffff"));
			txtLike.SetTextColor (Color.ParseColor("#ffffff"));

			txtAuthor.Gravity = GravityFlags.Right;
			txtChapter.Gravity = GravityFlags.Right;
			txtNameLO.Gravity = GravityFlags.Right;
			txtLike.Gravity = GravityFlags.Center;

			linearTextLO.AddView (txtNameLO);
			linearTextLO.AddView (txtChapter);
			linearTextLO.AddView (txtAuthor);

			linearLike.AddView (imgHeart);
			linearLike.AddView (txtLike);

			linearTextLO.SetX (0); linearTextLO.SetY (Configuration.getHeight(398));

			linearLike.SetX (0); linearLike.SetY (Configuration.getHeight(438));
			linearContainerFisrst.SetX (0); linearContainerFisrst.SetY (0);

			linearImageLO.SetX (0); linearImageLO.SetY (0);

			linearTextLO.SetPadding (0, 0, Configuration.getWidth (35), 0);
			this.AddView (linearImageLO);
			this.AddView (linearTextLO);
			this.AddView (linearLike);
			this.AddView (linearContainerFisrst);

		}
开发者ID:aocsa,项目名称:CInca,代码行数:97,代码来源:FrontContainerView.cs


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