本文整理汇总了C#中ImageView.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# ImageView.SetPadding方法的具体用法?C# ImageView.SetPadding怎么用?C# ImageView.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView.SetPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndicatorLayout
public IndicatorLayout(Context context, Mode mode)
: base(context)
{
//super(context);
mArrowImageView = new ImageView(context);
Drawable arrowD = Resources.GetDrawable(Resource.Drawable.indicator_arrow);
mArrowImageView.SetImageDrawable(arrowD);
int padding = Resources.GetDimensionPixelSize(Resource.Dimension.indicator_internal_padding);
mArrowImageView.SetPadding(padding, padding, padding, padding);
AddView(mArrowImageView);
int inAnimResId, outAnimResId;
switch (mode)
{
case Mode.PULL_FROM_END:
inAnimResId = Resource.Animation.slide_in_from_bottom;
outAnimResId = Resource.Animation.slide_out_to_bottom;
SetBackgroundResource(Resource.Drawable.indicator_bg_bottom);
// Rotate Arrow so it's pointing the correct way
mArrowImageView.SetScaleType(Android.Widget.ImageView.ScaleType.Matrix);
Matrix matrix = new Matrix();
matrix.SetRotate(180f, arrowD.IntrinsicWidth / 2f, arrowD.IntrinsicHeight / 2f);
mArrowImageView.ImageMatrix = matrix;
break;
default:
case Mode.PULL_FROM_START:
inAnimResId = Resource.Animation.slide_in_from_top;
outAnimResId = Resource.Animation.slide_out_to_top;
SetBackgroundResource(Resource.Drawable.indicator_bg_top);
break;
}
mInAnim = AnimationUtils.LoadAnimation(context, inAnimResId);
mInAnim.SetAnimationListener(this);
mOutAnim = AnimationUtils.LoadAnimation(context, outAnimResId);
mOutAnim.SetAnimationListener(this);
IInterpolator interpolator = new LinearInterpolator();
//mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
mRotateAnimation = new RotateAnimation(0, -180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
mRotateAnimation.Interpolator = interpolator;
mRotateAnimation.Duration = DEFAULT_ROTATION_ANIMATION_DURATION;
mRotateAnimation.FillAfter = true;
mResetRotateAnimation = new RotateAnimation(-180, 0, Dimension.RelativeToSelf, 0.5f,
Dimension.RelativeToSelf, 0.5f);
mResetRotateAnimation.Interpolator = interpolator;
mResetRotateAnimation.Duration = DEFAULT_ROTATION_ANIMATION_DURATION;
mResetRotateAnimation.FillAfter = true;
}
示例2: NewView
public override View NewView(Context context, ICursor cursor, ViewGroup parent)
{
var grid = (GridView)parent;
var imageView = new ImageView(context);
imageView.LayoutParameters = new GridView.LayoutParams(grid.ColumnWidth, grid.ColumnWidth);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
return imageView;
}
示例3: NewView
public override View NewView(Context context, ICursor cursor, ViewGroup parent)
{
var gv = parent as GridView;
int px = Utils.GetPixFromGridView(context, parent as GridView);
px = gv.ColumnWidth;
var imageView = new ImageView(context);
imageView.LayoutParameters = new GridView.LayoutParams(px, px);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
return imageView;
}
示例4: GetView
public override Android.Views.View GetView (int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
{
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
imageView = new ImageView (context);
imageView.LayoutParameters = new GridView.LayoutParams (120, 120);
imageView.SetScaleType (ImageView.ScaleType.CenterCrop);
imageView.SetPadding (8, 8, 8, 8);
} else {
imageView = (ImageView)convertView;
}
imageView.SetImageResource (thumbIds [position]);
return imageView;
}
示例5: GetView
public override View GetView (int position, View convertView, ViewGroup parent)
{
ImageView imageView;
if (convertView == null) {
imageView = new ImageView (self);
imageView.LayoutParameters = new GridView.LayoutParams (45, 45);
imageView.SetAdjustViewBounds (false);
imageView.SetScaleType (ImageView.ScaleType.CenterCrop);
imageView.SetPadding (8, 8, 8, 8);
} else {
imageView = (ImageView) convertView;
}
imageView.SetImageResource (mThumbIds[position]);
return imageView;
}
示例6: 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;
}
示例7: GetView
// create a new ImageView for each item
public override View GetView(int position, View convertView, ViewGroup parent)
{
if(convertView == null){
//if it's not recycled, initialize some attributes
imageView = new ImageView(context);
imageView.LayoutParameters = new GridView.LayoutParams(GridView.LayoutParams.WrapContent,GridView.LayoutParams.WrapContent);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8,8,8,8);
}else{
imageView=(ImageView)convertView;
}
Picasso.With(context).Load("http://image.tmdb.org/t/p/w185/"+posterPaths[position]).Into(imageView);
return imageView;
}
示例8: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
ImageView imageView;
if (convertView == null)
{
imageView = new ImageView(_context)
{
LayoutParameters = new Android.Widget.GridView.LayoutParams(85, 85)
};
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
}
else
{
imageView = (ImageView) convertView;
}
imageView.SetImageResource(_thumbIds[position]);
return imageView;
}
示例9: TabSetup
void TabSetup(ActionBar.Tab tab, int resID)
{
var linLay = new LinearLayout(activity)
{
LayoutParameters = new LayoutParams(LayoutParams.WrapContent, 180),
Orientation = Orientation.Vertical,
};
linLay.SetHorizontalGravity(Android.Views.GravityFlags.Center);
var imageView = new ImageView(activity);
imageView.SetImageResource(resID);
imageView.SetPadding(-35, 4, -35, 0);
imageView.SetMinimumWidth(60);
var textView = new TextView(activity)
{
Text = tab.Text
};
linLay.AddView(imageView);
linLay.AddView(textView);
tab.SetCustomView(linLay);
}
示例10: GetView
// create a new ImageView for each item referenced by the Adapter
public override View GetView(int position, View convertView, ViewGroup parent)
{
ImageView imageView;
if (convertView == null)
{ // if it's not recycled, initialize some attributes
imageView = new ImageView(context);
imageView.LayoutParameters = new GridView.LayoutParams(230, 230);
//imageView.LayoutParameters = new GridView.LayoutParams(190, 190);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(4, 4, 4, 4);
}
else
{
imageView = (ImageView)convertView;
}
Bitmap bmp = MediaStore.Images.Thumbnails.GetThumbnail(cr, items[position].ImageId, ThumbnailKind.MicroKind, null);
imageView.SetImageBitmap(bmp);
return imageView;
}
示例11: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
ImageView imageView;
if (convertView == null)
{
// if it's not recycled, initialize some attributes
imageView = new ImageView(context);
imageView.LayoutParameters = new AbsListView.LayoutParams(85, 85);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
}
else
{
imageView = (ImageView) convertView;
}
// Cache UI thread synchronization context.
var uiContext = TaskScheduler.FromCurrentSynchronizationContext ();
Task.Run (async () => {
var albumItem = albumItems.Skip (position).First ();
var pictureStream = await albumItem.GetFileAsync ();
if (pictureStream.Value != null)
{
// Use ContinueWith() here, so SetImageBitmap() will be called on the uiContext.
await BitmapFactory.DecodeStreamAsync (pictureStream.Value).ContinueWith((decodeTask) =>
{
imageView.SetImageBitmap (decodeTask.Result);
}, CancellationToken.None, TaskContinuationOptions.DenyChildAttach, uiContext);
}
});
return imageView;
}
示例12: GetSampleContent
public override View GetSampleContent (Context context)
{
btn = new Button(context);
btn.SetBackgroundResource(Resource.Drawable.burgericon);
FrameLayout.LayoutParams btlayoutParams = new FrameLayout.LayoutParams(42,32, GravityFlags.Center);
btn.LayoutParameters = btlayoutParams;
btn.SetPadding (10,0,0,0);
btn.Gravity=GravityFlags.CenterVertical;
TextView textView = new TextView(context);
textView.TextSize=20;
textView.Text="Home";
textView.SetTextColor (Color.White);
textView.Gravity=GravityFlags.Center;
LinearLayout linearLayout = new LinearLayout(context);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 70, GravityFlags.Center);
layoutParams.SetMargins (10,0,0,0);
linearLayout.SetPadding (10,0,0,0);
linearLayout.AddView(btn);linearLayout.AddView(textView,layoutParams);
linearLayout.SetBackgroundColor(Color.Rgb(47,173,227));
height = context.Resources.DisplayMetrics.HeightPixels-75;
width =context.Resources.DisplayMetrics.WidthPixels;
LinearLayout linear2 = new LinearLayout(context);
linear2.Orientation=Orientation.Vertical;
linear2.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
FrameLayout.LayoutParams layout2= new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);
linear2.AddView(linearLayout,layout2);
/**
* Main Content
* */
FrameLayout gridLayout = new FrameLayout(context);
gridLayout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
/**
* item1
*/
FrameLayout grid1 = new FrameLayout(context);
ImageView img1 = new ImageView(context);
img1.SetScaleType (ImageView.ScaleType.FitXy);
img1.SetImageResource(Resource.Drawable.profile);
FrameLayout.LayoutParams layoutParams1 = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center);
grid1.AddView(img1, layoutParams1);
grid1.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3);
/**
* item2
*/
FrameLayout grid2 = new FrameLayout(context);
ImageView img2 = new ImageView(context);
img2.SetImageResource(Resource.Drawable.inbox);
img2.SetScaleType (ImageView.ScaleType.FitXy);
grid2.AddView(img2, layoutParams1);
grid2.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3);
/**
* item3
*/
FrameLayout grid3 = new FrameLayout(context);
ImageView img3 = new ImageView(context);
img3.SetImageResource(Resource.Drawable.outbox);
img3.SetScaleType (ImageView.ScaleType.FitXy);
grid3.AddView(img3, layoutParams1);
grid3.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3);
/**
* item4
*/
FrameLayout grid4 = new FrameLayout(context);
ImageView img4 = new ImageView(context);
img4.SetImageResource(Resource.Drawable.flag);
img4.SetScaleType (ImageView.ScaleType.FitXy);
grid4.AddView(img4, layoutParams1);
grid4.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3);
/**
* item5
*/
FrameLayout grid5 = new FrameLayout(context);
ImageView img5 = new ImageView(context);
img5.SetImageResource(Resource.Drawable.trash);
img5.SetScaleType (ImageView.ScaleType.FitXy);
//.........这里部分代码省略.........
示例13: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
int px = Utils.GetPixFromGridView(context, parent as GridView);
ImageView imageView;
if (convertView == null) // if it's not recycled, initialize some attributes
{
imageView = new ImageView(context);
imageView.LayoutParameters = new GridView.LayoutParams(px, px);
imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
imageView.SetPadding(8, 8, 8, 8);
}
else
{
imageView = (ImageView)convertView;
}
imageView.SetImageBitmap(thumbIds[position]);
return imageView;
}
示例14: connect_ContentPacksGetByTypeCompleted
private void connect_ContentPacksGetByTypeCompleted(object s, ContentPacksGetByTypeAndAccountIDCompletedEventArgs e)
{
LOLConnectClient service = (LOLConnectClient)s;
service.ContentPacksGetByTypeAndAccountIDCompleted -= connect_ContentPacksGetByTypeCompleted;
if (e.Error == null)
{
RunOnUiThread(delegate
{
ContentPack[] result = e.Result.ToArray();
List<ContentPackDB> contentPackList = new List<ContentPackDB>();
LinearLayout layout = new LinearLayout(context);
layout.Orientation = Android.Widget.Orientation.Horizontal;
layout.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), (int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context));
layout.SetGravity(GravityFlags.CenterHorizontal);
int counter = 0;
foreach (ContentPack eachItem in result)
{
counter++;
if (eachItem.Errors.Count > 0)
{
#if(DEBUG)
System.Diagnostics.Debug.WriteLine("Error: {0}", StringUtils.CreateErrorMessageFromGeneralErrors(eachItem.Errors));
#endif
} else
{
ImageView contentpackpic = new ImageView(context);
contentpackpic.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(size, context), (int)ImageHelper.convertDpToPixel(size, context));
contentpackpic.SetPadding(0, 0, (int)ImageHelper.convertDpToPixel(10f, context), 0);
using (MemoryStream stream = new MemoryStream (eachItem.ContentPackIcon))
{
using (Android.Graphics.Drawables.Drawable draw = Android.Graphics.Drawables.Drawable.CreateFromStream (stream, "Profile"))
{
contentpackpic.SetImageDrawable(draw);
int cpackId = new int();
cpackId = eachItem.ContentPackID;
string cpackTitle = new string(new char[1]);
cpackTitle = eachItem.ContentPackTitle;
contentpackpic.Click += delegate
{
StartContentPackItemActivity(cpackId, cpackTitle);
};
layout.AddView(contentpackpic);
}
}
ContentPackDB contentPackDB = ContentPackDB.ConvertFromContentPack(eachItem);
SaveContentPack(contentPackDB);
contentPackList.Add(contentPackDB);
packID = contentPackDB.ID;
if (counter == result.Length || layout.ChildCount == 3)
{
listContentPack.AddView(layout);
layout = new LinearLayout(context);
layout.Orientation = Android.Widget.Orientation.Horizontal;
layout.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, 0, (int)ImageHelper.convertDpToPixel(10f, context));
layout.SetGravity(GravityFlags.CenterHorizontal);
}
SaveContentPack(contentPackDB);
}
}
DismissLightboxDialog();
dbm.InsertOrUpdateContentPacks(contentPackList);
cPackIsLoaded = true;
});
} else
{
string m = packType + Application.Context.Resources.GetString(Resource.String.errorDownloadFailGeneric);
RunOnUiThread(delegate
{
GeneralUtils.Alert(context, Application.Context.Resources.GetString(Resource.String.errorContentPackFail), m);
});
}
}
示例15: showPLaceInfo
public void showPLaceInfo(int position)
{
if (_leyendaShowed) {
showLeyenda ();
}
header.RemoveView (_leyendaMap);
_mainLayout.AddView(scrollPlaces);
titulo_header.Text = _currentPlaces [position].titulo;
scrollPlaces.SetBackgroundColor (Color.White);
placeInfoOpen = true;
placesInfoLayout.RemoveAllViews ();
int space = Configuration.getWidth (15);
var extraInfo = _placesData [position].placeExtraInfo;
for (int i = 0; i < extraInfo.Count; i++) {
bool flagSpace = false;
String url = extraInfo [i].url;
if (extraInfo [i].detalle != null) {
TextView detalle = new TextView (context);
detalle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight (32));
detalle.Typeface = Typeface.CreateFromAsset (context.Assets, "fonts/ArcherMediumPro.otf");
detalle.Text = extraInfo [i].detalle;
Linkify.AddLinks (detalle, MatchOptions.All);//HUILLCA
placesInfoLayout.AddView (detalle);
flagSpace = true;
}
if(url!=null){
ImageView image = new ImageView (context);
Picasso.With (context).Load (url).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).Resize(Configuration.getWidth(640),Configuration.getHeight(640)).CenterInside().Into (image);
placesInfoLayout.AddView (image);
if (flagSpace) {
image.SetPadding (0,space,0,space);
}
}
}
placesInfoLayout.SetBackgroundColor (Color.White);
}