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


C# ImageView.SetBackgroundColor方法代码示例

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


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

示例1: AddItem

        //here we only have img and text for each item
        //create a RelativeLayout and add it to dic
        //squear image
        public void AddItem(int imgresource,string text,Action OnCellClick)
        {
            RelativeLayout menucell = new RelativeLayout (nn_context);
            menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding));
            menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight));
            menucell.Click+= (object sender, EventArgs e) => {

                if(OnCellClick!=null){
                    OnCellClick();
                }
            };

            ImageView img = new ImageView (nn_context);
            img.Id = TapUtil.generateViewId ();
            img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth));
            //			Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false);
            img.SetImageResource (imgresource);
            img.SetBackgroundColor (Color.White);

            TextView textview = new TextView (nn_context);
            RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight));
            textviewparam.AddRule(LayoutRules.RightOf,img.Id);
            textviewparam.LeftMargin = TapUtil.dptodx (space);
            textview.LayoutParameters =textviewparam;
            textview.Text = text;
            textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            textview.SetTextColor(Color.Black);
            textview.Gravity = global::Android.Views.GravityFlags.Center;

            menucell.AddView (img);
            menucell.AddView (textview);

            nn_itemlist.Add (menucell);
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:37,代码来源:Tap5050MenuBuilder.cs

示例2: OnCreate

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

			ImageView imageView = new ImageView (this);
			// Set the background color to white
			imageView.SetBackgroundColor (Android.Graphics.Color.White);
			// Parse the SVG file from the resource
			SVG svg = SVGParser.GetSVGFromAsset (Assets, "svg/gradients.svg");
			// Get a drawable from the parsed SVG and set it as the drawable for the ImageView
			imageView.SetImageDrawable (svg.CreatePictureDrawable ());
			// Set the ImageView as the content view for the Activity
			SetContentView (imageView);
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:14,代码来源:SampleActivity.cs

示例3: createImages

        private void createImages(HorizontalScrollView view)
        {
            MediaMetadataRetriever data = new MediaMetadataRetriever();
            data.SetDataSource(filename);
            int videoLength = Convert.ToInt32(data.ExtractMetadata(MetadataKey.Duration));
            #if DEBUG
            Console.WriteLine("Duration = {0}, videoLength = {1}", data.ExtractMetadata(MetadataKey.Duration), videoLength);
            #endif
            LinearLayout linLay = new LinearLayout(context);
            linLay.Orientation = Android.Widget.Orientation.Horizontal;
            linLay.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);

            ShowLightboxDialog(Application.Resources.GetString(Resource.String.videoEditGenerateThumbs));
            ImageView imageView = new ImageView(context);
            imageView.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(55f, context),
                                                                    (int)ImageHelper.convertDpToPixel(55f, context));

            #if DEBUG
            for (int n = 0; n < videoLength; ++n)
            {
                using (Bitmap bmp = data.GetFrameAtTime((long)n * 1000, (int)Option.ClosestSync))
                {
                    if (bmp != null)
                        Console.WriteLine("frame {0} contains an image", n);
                }
            }
            #endif

            for (int n = 10; n < /*videoLength*/timeUsed * fps; ++n)
            {
                using (Bitmap bmp = data.GetFrameAtTime((long)n, (int)Option.ClosestSync))
                {
                    if (bmp != null)
                    {
                        using (Bitmap smBmp = Bitmap.CreateScaledBitmap(bmp, (int)ImageHelper.convertDpToPixel(55f, context),
                                                                    (int)ImageHelper.convertDpToPixel(55f, context), true))
                        {
                            int m = new int();
                            m = n;
                            imageView.Tag = m;
                            imageView.Click += (object sender, EventArgs e) => frameClicked(sender, e);
                            imageView.SetImageBitmap(smBmp);
                        }
                    } else
                        imageView.SetBackgroundColor(Color.AliceBlue);
                }
                RunOnUiThread(() => linLay.AddView(imageView));
            }

            DismissLightboxDialog();
            data.Release();
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:52,代码来源:EditVideo.cs

示例4: Initialize

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


			adsImagesPath.Add ("images/ad1.jpg");
			adsImagesPath.Add ("images/ad2.jpg");
			adsImagesPath.Add ("images/ad3.jpg");


			_leyendaMap = new ImageView(context);
			_leyendaMapBack = new ImageView(context);
			int w = Configuration.getWidth (25);
			int h = Configuration.getHeight (45);

			_leyendaMap.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/atras.png"), w, h, true));
			_leyendaMap.SetPadding (w, 0, 0, 0);
			_leyendaMap.Click += delegate {
				showLeyenda ();
			};


			leyendaLayout = new RelativeLayout (context);
			leyendaLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(500),Configuration.getHeight(1136-85));
			leyendaLayout.SetBackgroundColor (Color.White);
			leyendaLayout.SetX (Configuration.getWidth (640));
			leyendaLayout.Click += delegate {
				showLeyenda();
			};
			_leyendaImage = new ImageView (context);
			//_leyendaImage.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (500), -1);
			_leyendaImage.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("images/leyenda.png"),Configuration.getWidth (500),Configuration.getWidth(500),true));

			//_leyendaImage.SetX (Configuration.getWidth (141));
			_leyendaImage.SetY (Configuration.getHeight (125));

			_leyendaImage.SetBackgroundColor (Color.Black);



			_leyendaMapBack.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/adelante.png"), w, h, true));
			//_leyendaMapBack.Rotation = 180;
			_leyendaMapBack.SetPadding (w, 0, 0, 0);
			_leyendaMapBack.SetX (Configuration.getWidth (445));
			_leyendaMapBack.SetY (Configuration.getHeight (40));
			_leyendaMapBack.Click += delegate {
				showLeyenda ();
			};

			TextView tituloLeyenda = new TextView (context);
			tituloLeyenda.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (125));
			tituloLeyenda.Gravity = GravityFlags.Center;
			tituloLeyenda.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
			tituloLeyenda.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
			tituloLeyenda.Text = "LEYENDA";

			leyendaLayout.AddView (tituloLeyenda);
			leyendaLayout.AddView (_leyendaImage);
			leyendaLayout.AddView (_leyendaMapBack);



			loadIcons ();
			//loadMapas ();
			ini ();
			//iniNotifList ();
			this.AddView (_mainLayout);

		}
开发者ID:Milton761,项目名称:Hitec.Droid,代码行数:73,代码来源:MapView.cs

示例5: OnCreateView

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

                    // get the root control from our .axml
                    var layout = inflater.Inflate(Resource.Layout.Notes, container, false) as RelativeLayout;

                    // get the refresh button from the layout
                    RefreshButton = layout.FindViewById<Button>( Resource.Id.refreshButton );

                    // create our overridden lockable scroll view
                    ScrollView = new LockableScrollView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ScrollView.ScrollBarStyle = ScrollbarStyles.InsideInset;
                    ScrollView.OverScrollMode = OverScrollMode.Always;
                    ScrollView.VerticalScrollbarPosition = ScrollbarPosition.Default;
                    ScrollView.LayoutParameters = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                    ScrollView.Notes = this;
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.CenterHorizontal);
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.Below, Resource.Id.refreshButton);

                    // add it to our main layout.
                    layout.AddView( ScrollView );

                    Indicator = layout.FindViewById<ProgressBar>( Resource.Id.progressBar );
                    Indicator.Visibility = ViewStates.Gone;
                    Indicator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) );
                    Indicator.BringToFront();

                    // create the layout that will contain the notes
                    ScrollViewLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ScrollView.AddView( ScrollViewLayout );
                    ScrollViewLayout.SetOnTouchListener( this );

                    RefreshButton.Click += (object sender, EventArgs e ) =>
                    {
                        DeleteNote( );

                        PrepareCreateNotes(  );
                    };

                    // if the refresh button isn't enabled, hide it
                    if ( App.Shared.Network.RockGeneralData.Instance.Data.DeveloperModeEnabled == false )
                    {
                        RefreshButton.Visibility = ViewStates.Gone;
                    }

                    // get our power management control
                    PowerManager pm = PowerManager.FromContext( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Notes");

                    ResultView = new UIResultView( layout, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), OnResultViewDone );

                    ResultView.Hide( );

                    // setup the tutorial overlay
                    TutorialBacker = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TutorialBacker.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    TutorialBacker.Alpha = 0;
                    TutorialBacker.SetBackgroundColor( Android.Graphics.Color.Black );
                    layout.AddView( TutorialBacker );

                    AnimatingTutorial = false;
                    TutorialOverlay = new ImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TutorialOverlay.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ((RelativeLayout.LayoutParams)TutorialOverlay.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    TutorialOverlay.Alpha = 0;
                    TutorialOverlay.SetBackgroundColor( Android.Graphics.Color.Transparent );
                    layout.AddView( TutorialOverlay );

                    NavBarRevealTracker = new NavBarReveal( );

                    return layout;
                }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:73,代码来源:NotesFragment.cs


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