本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}