本文整理汇总了C#中LinearLayout.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.SetPadding方法的具体用法?C# LinearLayout.SetPadding怎么用?C# LinearLayout.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.SetPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateDialogView
protected override View OnCreateDialogView()
{
var layout = new LinearLayout(_context) {Orientation = Orientation.Vertical};
layout.SetPadding(10, 10, 10, 10);
layout.SetBackgroundColor(Color.Black);
_serverUrl = new TextView(_context) {Text = "Server url:"};
_serverUrl.SetTextColor(Color.White);
_serverUrl.SetPadding(0, 8, 0, 3);
_serverUrlBox = new EditText(_context);
_serverUrlBox.SetSingleLine(true);
_userKey = new TextView(_context) {Text = "User key:"};
_userKey.SetTextColor(Color.White);
_userKeyBox = new EditText(_context);
_userKeyBox.SetSingleLine(true);
layout.AddView(_serverUrl);
layout.AddView(_serverUrlBox);
layout.AddView(_userKey);
layout.AddView(_userKeyBox);
return layout;
}
示例2: MyTooltip
public MyTooltip(FlexPie pie, Context context)
: base(pie)
{
txtLabel = new TextView(context);
LinearLayout layout = new LinearLayout(context);
layout.Orientation = Orientation.Vertical;
layout.SetBackgroundColor(Android.Graphics.Color.Gray);
layout.SetPadding(5, 5, 5, 5);
layout.AddView(txtLabel);
AddView(layout);
}
示例3: Tap5050MenuBuilder
// int all in dp
public Tap5050MenuBuilder(Context context,int backgroundresource=Resource.Color.soarnix_bg_gray,int containerpadding=5,int containerspacing=1)
{
nn_containerspacing = containerspacing;
nn_containterpadding=containerpadding;
nn_context = context;
nn_menucontainer = new LinearLayout (context);
nn_menucontainer.SetBackgroundResource (backgroundresource);
nn_menucontainer.SetPadding (TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding));
nn_menucontainer.Orientation = Orientation.Vertical;
nn_itemlist = new List<RelativeLayout>();
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//Create the user interface in code
var layout = new LinearLayout(this);
layout.Orientation = Orientation.Vertical;
layout.SetPadding(50, 25, 50, 25);
var aLabel = new TextView(this);
aLabel.Text = "Total Amount";
txtAmount = new EditText(this);
txtAmount.InputType = global::Android.Text.InputTypes.ClassNumber;
scrollPeople = new SeekBar(this);
scrollPeople.Max = 20;
scrollPeople.Progress = 1;
scrollTip = new SeekBar(this);
scrollTip.Progress = 15;
scrollTip.Max = 100;
lblTotalCost = new TextView(this);
lblTipAmount = new TextView(this);
lblTotalPerPerson = new TextView(this);
lblTipPercent = new TextView(this);
lblNumPeople = new TextView(this);
layout.AddView(aLabel);
layout.AddView(txtAmount);
layout.AddView(lblTipPercent);
layout.AddView(scrollTip);
layout.AddView(lblNumPeople);
layout.AddView(scrollPeople);
layout.AddView(lblTipAmount);
layout.AddView(lblTotalCost);
layout.AddView(lblTotalPerPerson);
// Set our view from the "main" layout resource
SetContentView(layout);
InitializeInternal();
}
示例5: GetSampleContent
public override View GetSampleContent (Context con)
{
LinearLayout linear = new LinearLayout(con);
linear.SetBackgroundColor(Color.White);
linear.Orientation = Orientation.Vertical;
linear.SetPadding(10, 10, 10, 10);
TextView text1 = new TextView(con);
text1.TextSize = 16;
text1.SetTextColor(Color.ParseColor("#262626"));
text1.Typeface = Typeface.DefaultBold;
text1.Text = "Allowed Characters";
text1.SetPadding(5, 10, 10, 5);
linear.AddView(text1);
TextView text2 = new TextView(con);
text2.TextSize = 14;
text2.SetTextColor(Color.ParseColor("#3F3F3F"));
text2.Text = "All 128 ASCII Characters";
text2.SetPadding(5, 5, 5, 5);
LinearLayout text2Layout = new LinearLayout(con);
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
text2Layout.LayoutParameters = parms;
text2Layout.AddView(text2);
linear.AddView(text2Layout);
LinearLayout barcodeLayout = new LinearLayout(con);
barcodeLayout.SetPadding(0, 10, 0, 5);
LinearLayout.LayoutParams parms1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
barcodeLayout.LayoutParameters = parms1;
barcode = new SfBarcode(con);
barcode.Text = "G71C0453";
Typeface fontFamily = Typeface.Create("helvetica", TypefaceStyle.Bold);
barcode.TextFont = fontFamily;
barcode.SetBackgroundColor(Color.ParseColor("#F2F2F2"));
barcode.Symbology = BarcodeSymbolType.Code39Extended;
barcode.TextSize = 20;
Code39ExtendedSettings setting = new Code39ExtendedSettings();
setting.BarHeight = 120;
setting.NarrowBarWidth = 3;
barcode.SymbologySettings = setting;
barcodeLayout.AddView(barcode);
linear.AddView(barcodeLayout);
return linear;
}
示例6: GetSampleContent
public override View GetSampleContent (Context con)
{
LinearLayout linear = new LinearLayout(con);
linear.SetBackgroundColor(Color.White);
linear.Orientation = Orientation.Vertical;
linear.SetPadding(10, 10, 10, 10);
TextView text1 = new TextView(con);
text1.TextSize = 16;
text1.SetTextColor(Color.ParseColor("#262626"));
text1.Typeface = Typeface.DefaultBold;
text1.Text = "Allowed Characters";
text1.SetPadding(5, 10, 10, 5);
linear.AddView(text1);
TextView text2 = new TextView(con);
text2.TextSize = 14;
text2.SetTextColor(Color.ParseColor("#3F3F3F"));
text2.Text = "ASCII values from 32 to 127\nSPACE ! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ]^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ DEL";
text2.SetPadding(5, 5, 5, 5);
LinearLayout text2Layout = new LinearLayout(con);
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
text2Layout.LayoutParameters = parms;
text2Layout.AddView(text2);
linear.AddView(text2Layout);
LinearLayout barcodeLayout = new LinearLayout(con);
barcodeLayout.SetPadding(0, 10, 0, 5);
LinearLayout.LayoutParams parms1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
barcodeLayout.LayoutParameters = parms1;
barcode = new SfBarcode(con);
barcode.Text = "ISBN-678504";
Typeface fontFamily = Typeface.Create("helvetica", TypefaceStyle.Bold);
barcode.TextFont = fontFamily;
barcode.SetBackgroundColor(Color.ParseColor("#F2F2F2"));
barcode.Symbology = BarcodeSymbolType.Code128B;
barcode.TextSize = 20;
Code128BSettings setting = new Code128BSettings();
setting.BarHeight = 120;
setting.NarrowBarWidth = 3;
barcode.SymbologySettings = setting;
barcodeLayout.AddView(barcode);
linear.AddView(barcodeLayout);
return linear;
}
示例7: GetSampleContent
public override View GetSampleContent (Context con)
{
LinearLayout linear = new LinearLayout(con);
linear.SetBackgroundColor(Color.White);
linear.Orientation = Orientation.Vertical;
linear.SetPadding(10, 10, 10, 10);
TextView text1 = new TextView(con);
text1.TextSize = 16;
text1.SetTextColor(Color.ParseColor("#262626"));
text1.Typeface = Typeface.DefaultBold;
text1.Text = "Allowed Characters";
text1.SetPadding(5, 10, 10, 5);
linear.AddView(text1);
TextView text2 = new TextView(con);
text2.TextSize = 14;
text2.SetTextColor(Color.ParseColor("#3F3F3F"));
text2.Text = "ASCII values from 0 to 95\nNUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US SPACE ! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ]^ _";
text2.SetPadding(5, 5, 5, 5);
LinearLayout text2Layout = new LinearLayout(con);
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
text2Layout.LayoutParameters = parms;
text2Layout.AddView(text2);
linear.AddView(text2Layout);
LinearLayout barcodeLayout = new LinearLayout(con);
barcodeLayout.SetPadding(0, 10, 0, 5);
LinearLayout.LayoutParams parms1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
barcodeLayout.LayoutParameters = parms1;
barcode = new SfBarcode(con);
barcode.Text = "ACL32 SF-D8";
Typeface fontFamily = Typeface.Create("helvetica", TypefaceStyle.Bold);
barcode.TextFont = fontFamily;
barcode.SetBackgroundColor(Color.ParseColor("#F2F2F2"));
barcode.Symbology = BarcodeSymbolType.Code128A;
barcode.TextSize = 20;
Code128ASettings setting = new Code128ASettings();
setting.BarHeight = 120;
setting.NarrowBarWidth = 3;
barcode.SymbologySettings = setting;
barcodeLayout.AddView(barcode);
linear.AddView(barcodeLayout);
return linear;
}
示例8: InitView
public void InitView(List<BookingDocumentDto> _bookingDocs) {
this.RemoveAllViews ();
int size = _bookingDocs.Count;
for(int i = 0; i < size; i ++) {
LinearLayout ll = new LinearLayout (_context);
ll.Orientation = Orientation.Horizontal;
ll.SetVerticalGravity (GravityFlags.CenterVertical);
ImageView imgFile = new ImageView (_context);
imgFile.SetImageResource (Resource.Drawable.ic_attach);
var tvFileAttach = new TextView (_context) {
Text = _bookingDocs[i].OriginalFileName
};
tvFileAttach.Id = i;
tvFileAttach.SetTextColor (Color.Blue);
tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
tvFileAttach.SetSingleLine (true);
tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
tvFileAttach.SetPadding (5, 0, 10, 0);
LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
tvFileAttach.LayoutParameters = param;
tvFileAttach.Click += (sender, e) => {
utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
};
ImageButton imgDelete = new ImageButton (_context);
imgDelete.Id = i;
imgDelete.SetImageResource (Resource.Drawable.ic_delete);
imgDelete.SetMinimumWidth (50);
imgDelete.SetMinimumHeight (50);
imgDelete.SetBackgroundColor (Color.Transparent);
imgDelete.Click += (sender, e) => {
_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
};
ll.AddView (imgFile);
ll.AddView (tvFileAttach);
ll.AddView (imgDelete);
ll.SetPadding (0, 5, 0, 5);
this.AddView (ll);
}
}
示例9: 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;
}
示例10: ini
public void ini(){
var textFormat = Android.Util.ComplexUnitType.Px;
var textFormatdip = Android.Util.ComplexUnitType.Dip;
mainLayout = new RelativeLayout (context);
mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
mainLinearLayout = new LinearLayout (context);
headerLinearLayout = new LinearLayout (context);
contentLinearLayout = new LinearLayout (context);
mainHeaderLinearLayout = new LinearLayout (context);
imHeader = new ImageView (context);
titleHeader = new TextView (context);
AutorHeader = new TextView (context);
content = new TextView (context);
titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
AutorHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125));
contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
mainLinearLayout.Orientation = Orientation.Vertical;
mainHeaderLinearLayout.Orientation = Orientation.Horizontal;
headerLinearLayout.Orientation = Orientation.Vertical;
contentLinearLayout.Orientation = Orientation.Vertical;
mainLinearLayout.AddView (mainHeaderLinearLayout);
mainLinearLayout.AddView (contentLinearLayout);
mainHeaderLinearLayout.AddView (imHeader);
mainHeaderLinearLayout.AddView (headerLinearLayout);
headerLinearLayout.AddView (titleHeader);
headerLinearLayout.AddView (AutorHeader);
headerLinearLayout.SetPadding (15, 0, 0, 10);
AutorHeader.SetPadding (0, 15, 0, 0);
contentLinearLayout.AddView (content);
contentLinearLayout.SetPadding (0, 15, 0, 0);
mainLinearLayout.SetBackgroundResource (Resource.Drawable.border);
// mainLinearLayout.SetX (Configuration.getHeight (45));
//mainLinearLayout.SetY (Configuration.getWidth (500));
//titleHeader.Text = "Diferentes tipos de aves en Perú";
titleHeader.SetTextColor (Color.ParseColor ("#FF0080"));
//titleHeader.SetTextSize (textFormat, Configuration.getHeight (38));
titleHeader.SetTextSize (textFormatdip, 16.0f);
titleHeader.SetMaxWidth (Configuration.getWidth (274));
titleHeader.SetMaxHeight (Configuration.getHeight (80));
//titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion));
titleHeader.Ellipsize = TextUtils.TruncateAt.End;
titleHeader.SetMaxLines(2);
//AutorHeader.Text = "Autor del Articulo";
AutorHeader.SetTextColor(Color.ParseColor ("#424242"));
AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23));
AutorHeader.SetMaxWidth (Configuration.getWidth (274));
//AutorHeader.SetMaxHeight (Configuration.getHeight (25));
//AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion));
AutorHeader.Ellipsize = TextUtils.TruncateAt.End;
AutorHeader.SetMaxLines(1);
//content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de";
//content.SetTextSize (textFormat, Configuration.getHeight (24));
content.SetTextSize (textFormatdip, 12.0f);
content.SetMaxWidth (Configuration.getWidth(501));
//content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion));
//content.Ellipsize = TextUtils.TruncateAt.End;
//content.SetMaxLines(4);
//imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true));
//imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion));
imHeader.SetMaxWidth (Configuration.getWidth (124));
imHeader.SetMaxHeight (Configuration.getWidth (124));
int padW = Configuration.getWidth(45);
int padH = Configuration.getHeight (15);
mainLayout.SetPadding (padW,padH,padW,padH);
//.........这里部分代码省略.........
示例11: 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);
txtDescription = new TextView (context);
txtTitle = new TextView (context);
//txtLike = new TextView (context);
//imgBack = new ImageButton(context);
txtDescription= new TextView (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));
int space = Configuration.getWidth (30);
linearTextLO.SetPadding (space,0,space,0);
// linearLike.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(120), Configuration.getHeight(80));
linearTextLO.Orientation = Orientation.Vertical;
linearTextLO.SetGravity(GravityFlags.Right);
// linearLike.Orientation = Orientation.Vertical;
// linearLike.SetGravity (GravityFlags.Center);
//initButtonColor(imgBack);
linearContainerFisrst.Orientation = Orientation.Vertical;
//Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 240, 320, true));
//linearImageLO.SetBackgroundDrawable (d);
//imgBack.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/atras.png"), Configuration.getWidth(43), Configuration.getWidth(43), true));
txtTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(40));
txtTitle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
//txtTitle.Typeface = Typeface.DefaultBold;
txtDescription.SetTextColor (Color.ParseColor("#ffffff"));
txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
//txtLike.SetTextColor (Color.ParseColor("#ffffff"));
txtDescription.Gravity = GravityFlags.Right;
txtTitle.Gravity = GravityFlags.Right;
//txtLike.Gravity = GravityFlags.Center;
linearTextLO.AddView (txtTitle);
//linearTextLO.AddView (txtDescription);
//linearLike.AddView (imgBack);
//linearLike.AddView (txtLike);
linearTextLO.SetX (0); linearTextLO.SetY (Configuration.getHeight(398));
//imgBack.SetX (Configuration.getWidth (20)); imgBack.SetY (Configuration.getHeight (20));
//linearLike.SetX (0); linearLike.SetY (Configuration.getHeight(438));
linearContainerFisrst.SetX (0); linearContainerFisrst.SetY (0);
linearImageLO.SetX (0); linearImageLO.SetY (0);
this.AddView (linearImageLO);
this.AddView (linearTextLO);
//this.AddView (imgBack);
this.AddView (linearContainerFisrst);
}
示例12: initItems
//.........这里部分代码省略.........
int heightItem = Configuration.getHeight (310);
//Bitmap likeBitmap = Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/like.png"), Configuration.getWidth (30), Configuration.getWidth (30), true);
for (int i = 0; i < title.Count; i++)
{
LinearLayout item = new LinearLayout (context);
item.LayoutParameters = new LinearLayout.LayoutParams (-1, heightItem);
item.Orientation = Orientation.Horizontal;
item.SetGravity (GravityFlags.Center);
Drawable cover = new BitmapDrawable (getBitmapFromAsset(coverImagePath[i]));
item.SetBackgroundDrawable (cover);
_coverImages.Add (cover);
TextView itemTitle = new TextView (context);
itemTitle.Text = title [i];
itemTitle.SetTextColor (Color.ParseColor("#ffffff"));
itemTitle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
itemTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(45));
LinearLayout linearTitle = new LinearLayout (context);
linearTitle.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(465),Configuration.getHeight(180));
linearTitle.Orientation = Orientation.Vertical;
linearTitle.SetGravity (GravityFlags.Center);
linearTitle.AddView (itemTitle);
ImageView iconlike = new ImageView (context);
//iconlike.SetImageBitmap(likeBitmap);
LinearLayout linearLike = new LinearLayout (context);
linearLike.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
linearLike.Orientation = Orientation.Vertical;
linearLike.SetGravity (GravityFlags.CenterHorizontal);
TextView txtnumLike = new TextView (context);
txtnumLike.Text = numLikes[i];
txtnumLike.Gravity = GravityFlags.CenterHorizontal;
txtnumLike.SetTextColor (Color.ParseColor ("#ffffff"));
//linearLike.AddView (iconlike);
//linearLike.AddView (txtnumLike);
LinearLayout linearType = new LinearLayout (context);
linearType.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
linearType.Orientation = Orientation.Vertical;
linearType.SetGravity (GravityFlags.CenterHorizontal);
TextView txtnumType = new TextView (context);
txtnumType.Text = numTypes[i];
txtnumType.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
txtnumType.TextSize = Configuration.getHeight (15);
txtnumType.Gravity = GravityFlags.CenterHorizontal;
txtnumType.SetTextColor (Color.ParseColor ("#ffffff"));
TextView txtType = new TextView (context);
txtType.Text = type[i];
txtType.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
txtType.TextSize = Configuration.getHeight (15);
txtType.Gravity = GravityFlags.CenterHorizontal;
txtType.SetTextColor (Color.ParseColor ("#ffffff"));
int space = Configuration.getHeight (20);
linearLike.SetPadding (0, 0, 0, space);
linearType.SetPadding (space, 0, 0, 0);
linearType.AddView (txtnumType);
linearType.AddView (txtType);
LinearLayout linearExtraInfo = new LinearLayout (context);
linearExtraInfo.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(100), -2);
linearExtraInfo.Orientation = Orientation.Vertical;
linearExtraInfo.SetGravity (GravityFlags.CenterHorizontal);
linearExtraInfo.AddView (linearLike);
linearExtraInfo.AddView (linearType);
item.AddView (linearTitle);
//item.AddView (linearExtraInfo);
_listLinearItem.Add (item);
_linearContentLayout.AddView (_listLinearItem [i]);
}
}
示例13: basesList_ItemClick
void basesList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
{
if (e.Position < _manager.Infobases.Length)
{
InfobaseManager.Infobase currentInfobase = _manager.Infobases[e.Position];
foreach (var infobase in _manager.Infobases)
if (infobase != currentInfobase)
infobase.IsActive = false;
var settings = new Settings(_prefs, Activity.Resources.Configuration.Locale.Language, currentInfobase);
_resultCallback(settings);
}
else
using (var builder = new AlertDialog.Builder(Activity))
{
builder.SetTitle(D.CREATE_NEW_INFOBASE);
var ll = new LinearLayout(Activity) { Orientation = Orientation.Vertical };
ll.SetPadding(10, 5, 10, 5);
builder.SetView(ll);
ll.AddView(new TextView(Activity) { Text = D.INFOBASE_NAME });
var editName = new EditText(Activity);
editName.SetSingleLine();
ll.AddView(editName);
ll.AddView(new TextView(Activity) { Text = D.URL });
var editUrl = new EditText(Activity) { Text = "http://" };
editUrl.SetSingleLine();
ll.AddView(editUrl);
ll.AddView(new TextView(Activity) { Text = D.APPLICATION });
var editApplication = new EditText(Activity) { Text = "app" };
editApplication.SetSingleLine();
ll.AddView(editApplication);
ll.AddView(new TextView(Activity) { Text = D.FTP_PORT });
var editFtpPort = new EditText(Activity) { Text = "21" };
editFtpPort.SetSingleLine();
ll.AddView(editFtpPort);
builder.SetPositiveButton(D.OK, (s, args) =>
{
_manager.CreateInfobase(editName.Text, editUrl.Text
, editApplication.Text, editFtpPort.Text);
LoadList();
});
builder.SetNegativeButton(D.CANCEL, (s, args) => { });
builder.Show();
}
}
示例14: createMessageBar
private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver)
{
LinearLayout icons = new LinearLayout (context);
icons.Orientation = Orientation.Horizontal;
icons.SetGravity (GravityFlags.Left);
icons.SetVerticalGravity (GravityFlags.CenterVertical);
icons.SetMinimumHeight (30);
icons.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
if (message.MessageStepDBList.Count == 0) {
ImageView random1 = 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);
random1.LayoutParameters = lp;
}
random1.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
random1.SetBackgroundResource (Resource.Drawable.playblack);
random1.ContentDescription = message.MessageGuid;
random1.Click += delegate {
Messages.MessageReceived m = new Messages.MessageReceived (message, context);
};
RunOnUiThread (() => icons.AddView (random1));
} 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:
ImageView random2 = 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);
random2.LayoutParameters = lp;
}
random2.SetBackgroundResource (Resource.Drawable.textmsg);
random2.ContentDescription = message.MessageID.ToString ();
random2.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random2));
break;
case LOLMessageDelivery.MessageStep.StepTypes.Animation:
ImageView random3 = 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);
random3.LayoutParameters = lp;
}
random3.SetBackgroundResource (Resource.Drawable.drawicon);
random3.ContentDescription = message.MessageID.ToString ();
random3.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random3));
break;
case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
ImageView random4 = 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);
random4.LayoutParameters = lp;
}
random4.SetBackgroundResource (Resource.Drawable.comicon);
random4.ContentDescription = message.MessageID.ToString ();
random4.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random4));
break;
case LOLMessageDelivery.MessageStep.StepTypes.Comix:
ImageView random5 = 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);
random5.LayoutParameters = lp;
}
random5.SetBackgroundResource (Resource.Drawable.comix);
random5.ContentDescription = message.MessageID.ToString ();
random5.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random5));
break;
case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
ImageView random6 = 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);
random6.LayoutParameters = lp;
}
random6.SetBackgroundResource (Resource.Drawable.emoticon);
random6.ContentDescription = message.MessageID.ToString ();
random6.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random6));
break;
case LOLMessageDelivery.MessageStep.StepTypes.Polling:
ImageView random7 = 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);
random7.LayoutParameters = lp;
}
random7.SetBackgroundResource (Resource.Drawable.polls);
random7.ContentDescription = message.MessageID.ToString ();
random7.Click += new EventHandler (imgMessage_Click);
RunOnUiThread (() => icons.AddView (random7));
break;
case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
ImageView random8 = 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);
random8.LayoutParameters = lp;
}
//.........这里部分代码省略.........
示例15: 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 ());
});
}