本文整理汇总了C#中Button.SetTextSize方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetTextSize方法的具体用法?C# Button.SetTextSize怎么用?C# Button.SetTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.SetTextSize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StyleButton
public static void StyleButton( Button button, string text, string font, uint size )
{
// load up the rounded drawable and set the color
Drawable buttonDrawable = (Drawable)Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources.GetDrawable( Resource.Drawable.RoundButton );
buttonDrawable.SetColorFilter( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Button_BGColor ), PorterDuff.Mode.SrcAtop );
button.Background = buttonDrawable;
button.Text = text;
button.SetAllCaps( false );
button.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal );
button.SetTextSize( Android.Util.ComplexUnitType.Dip, size );
button.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Button_TextColor ) );
}
示例2: CreateItems
/**
* 创建MenuItem
*/
private void CreateItems()
{
//if (_items != null && _items.Count > 0)
// for (int i = 0; i < _items.Count; i++)
// {
// var itemButton = new Button(_mContext)
// {
// Id = CancelButtonId + i + 1
// };
// itemButton.SetOnClickListener(this);
// itemButton.Background = GetOtherButtonBg(_items.ToArray(), i);
// //itemButton.SetBackgroundDrawable(GetOtherButtonBg(_items.ToArray(), i));
// itemButton.Text = _items[i];
// itemButton.SetTextColor(new Color(_mAttrs.OtherButtonTextColor));
// itemButton.SetTextSize(ComplexUnitType.Dip, _mAttrs.ActionSheetTextSize);
// if (i > 0)
// {
// LinearLayout.LayoutParams layoutParams = CreateButtonLayoutParams();
// layoutParams.TopMargin = _mAttrs.OtherButtonSpacing;
// _mPanel.AddView(itemButton, layoutParams);
// }
// else
// _mPanel.AddView(itemButton);
// }
Button bt = new Button(_mContext);
bt.Paint.FakeBoldText = true;
bt.SetTextSize(ComplexUnitType.Dip, _mAttrs.ActionSheetTextSize);
bt.Id = CancelButtonId;
bt.Background = _mAttrs.CancelButtonBackground;
//bt.SetBackgroundDrawable(_mAttrs.CancelButtonBackground);
bt.Text = _cancelTitle;
bt.SetTextColor(new Color(_mAttrs.CancelButtonTextColor));
bt.SetOnClickListener(this);
LinearLayout.LayoutParams param = CreateButtonLayoutParams();
param.TopMargin = _mAttrs.CancelButtonMarginTop;
_mPanel.AddView(bt, param);
_mPanel.Background = _mAttrs.Background;
//_mPanel.SetBackgroundDrawable(_mAttrs.Background);
_mPanel.SetPadding(_mAttrs.Padding, _mAttrs.Padding, _mAttrs.Padding, _mAttrs.Padding);
}
示例3: CreateSpringboardButton
void CreateSpringboardButton( RelativeLayout relativeLayout )
{
// create the button
SpringboardRevealButton = new Button( Activity );
// clear the background outline
SpringboardRevealButton.Background = null;
// position it vertically centered and a little right indented
SpringboardRevealButton.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)SpringboardRevealButton.LayoutParameters).AddRule( LayoutRules.CenterVertical );
SpringboardRevealButton.SetX( 10 );
// set the font and text
Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
SpringboardRevealButton.SetTypeface( fontFace, TypefaceStyle.Normal );
SpringboardRevealButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivatePrimaryNavBarConfig.RevealButton_Size );
SpringboardRevealButton.Text = PrivatePrimaryNavBarConfig.RevealButton_Text;
// use the completely overcomplicated color states to set the normal vs pressed color state.
int [][] states = new int[][]
{
new int[] { Android.Resource.Attribute.StatePressed },
new int[] { Android.Resource.Attribute.StateEnabled },
new int[] { -Android.Resource.Attribute.StateEnabled },
};
// let the "pressed" version just use a darker version of the normal color
uint mutedColor = Rock.Mobile.Graphics.Util.ScaleRGBAColor( ControlStylingConfig.TextField_PlaceholderTextColor, 2, false );
int [] colors = new int[]
{
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ),
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
};
SpringboardRevealButton.SetTextColor( new Android.Content.Res.ColorStateList( states, colors ) );
// setup the click callback
SpringboardRevealButton.Click += (object sender, System.EventArgs e) =>
{
RevealSpringboard( !SpringboardRevealed );
SpringboardParent.RevealButtonClicked( );
};
relativeLayout.AddView( SpringboardRevealButton );
}
示例4: Initialize
void Initialize()
{
this.Orientation = Orientation.Vertical;
this.WeightSum = 1;
var padding = PixelConverter.DpToPixels(5);
SetPadding(padding, padding, padding, padding);
//Event handler is detached in proceed button handler. Very important!
((MainActivity)(this.context)).OptionItemSelected += OnOptionItemSelected;
SearchCityText = new TextView(context);
SearchCityText.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
SearchCityText.Text = string.Format("Search {0} for: ", location.SiteName);
SearchCityText.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.50f);
SearchCityText.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15));
LinearLayout searchCityHolder = RowHolder();
searchCityHolder.AddView(SearchCityText);
AddView(searchCityHolder);
proceedButton = new Button(context);
proceedButton.LayoutParameters = new LayoutParams(0, LayoutParams.WrapContent, 0.5f);
proceedButton.Text = "Search";
proceedButton.SetTextSize(ComplexUnitType.Px, rowHeight * 0.5f);
proceedButton.SetBackgroundResource(Resource.Drawable.roundedButton);
proceedButton.SetTextColor(context.Resources.GetColor(Resource.Color.lightTextColor));
LinearLayout buttonLayout = RowHolder();
buttonLayout.AddView(proceedButton);
AddView(buttonLayout);
var tableItems = GetTableSetup();
foreach (var item in tableItems)
{
AddRowToLayout(item);
}
proceedButton.Click += ProceedButton_Click;
}
示例5: OnCreateView
//.........这里部分代码省略.........
CropViewMaxPos = new PointF( CropViewMinPos.X + (scaledWidth - CropView.LayoutParameters.Width),
CropViewMinPos.Y + (scaledHeight - CropView.LayoutParameters.Height) );
view.AddView( CropView );
// create a mask layer that will block out the parts of the image that will be cropped
MaskLayer = new Rock.Mobile.PlatformSpecific.Android.Graphics.MaskLayer( (int)ScreenSize.Width, (int)ScreenSize.Height, CropView.LayoutParameters.Width, CropView.LayoutParameters.Height, Rock.Mobile.PlatformSpecific.Android.Core.Context );
MaskLayer.LayoutParameters = new RelativeLayout.LayoutParams( (int)ScreenSize.Width, (int)ScreenSize.Height );
MaskLayer.Opacity = 0.00f;
view.AddView( MaskLayer );
// Now setup our bottom area with cancel, crop, and text to explain
RelativeLayout bottomBarLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
bottomBarLayout.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)bottomBarLayout.LayoutParameters).AddRule( LayoutRules.AlignParentBottom );
// set the nav subBar color (including opacity)
Color navColor = Rock.Mobile.UI.Util.GetUIColor( PrivateSubNavToolbarConfig.BackgroundColor );
navColor.A = (Byte) ( (float) navColor.A * PrivateSubNavToolbarConfig.Opacity );
bottomBarLayout.SetBackgroundColor( navColor );
bottomBarLayout.LayoutParameters.Height = 150;
view.AddView( bottomBarLayout );
// setup the cancel button (which will undo cropping or take you back to the picture taker)
CancelButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
CancelButton.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
CancelButton.Gravity = GravityFlags.Left;
((RelativeLayout.LayoutParams)CancelButton.LayoutParameters).AddRule( LayoutRules.AlignParentLeft );
// set the crop button's font
Android.Graphics.Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
CancelButton.SetTypeface( fontFace, Android.Graphics.TypefaceStyle.Normal );
CancelButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateImageCropConfig.CropCancelButton_Size );
CancelButton.Text = PrivateImageCropConfig.CropCancelButton_Text;
CancelButton.Click += (object sender, EventArgs e) =>
{
// don't allow button presses while animations are going on
if( Animating == false )
{
// if they hit cancel while previewing, go back to editing
if( Mode == CropMode.Previewing )
{
SetMode( CropMode.Editing );
}
else
{
// they pressed it while they're in editing mode, so go back to camera mode
Activity.OnBackPressed( );
}
}
};
bottomBarLayout.AddView( CancelButton );
// setup the Confirm button, which will use a font to display its graphic
ConfirmButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ConfirmButton.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
ConfirmButton.Gravity = GravityFlags.Right;
((RelativeLayout.LayoutParams)ConfirmButton.LayoutParameters).AddRule( LayoutRules.AlignParentRight );
// set the crop button's font
fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
ConfirmButton.SetTypeface( fontFace, Android.Graphics.TypefaceStyle.Normal );
ConfirmButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateImageCropConfig.CropOkButton_Size );
ConfirmButton.Text = PrivateImageCropConfig.CropOkButton_Text;
// when clicked, we should crop the image.
ConfirmButton.Click += (object sender, EventArgs e) =>
{
// don't allow button presses while animations are going on
if( Animating == false )
{
// if they pressed confirm while editing, go to preview
if( Mode == CropMode.Editing )
{
SetMode( CropMode.Previewing );
}
else
{
// notify the caller
SpringboardParent.ModalFragmentDone( CroppedImage );
}
}
};
bottomBarLayout.AddView( ConfirmButton );
// start in editing mode (obviously)
SetMode( CropMode.Editing );
// start the cropper centered
MoveCropView( new PointF( (ScreenSize.Width - CropView.LayoutParameters.Width) / 2, (ScreenSize.Height - CropView.LayoutParameters.Height) / 2 ) );
MaskLayer.Position = new PointF( CropView.GetX( ), CropView.GetY( ) );
return view;
}
示例6: GroupListItem
public GroupListItem( Context context ) : base( context )
{
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
Orientation = Orientation.Vertical;
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
contentLayout.Orientation = Orientation.Horizontal;
AddView( contentLayout );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
TitleLayout.Orientation = Orientation.Vertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Title );
Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
JoinButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
JoinButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Weight = 0;
( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
JoinButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
JoinButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.GroupFinder_Join_IconSize );
JoinButton.Text = PrivateConnectConfig.GroupFinder_JoinIcon;
JoinButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
JoinButton.Background = null;
JoinButton.FocusableInTouchMode = false;
JoinButton.Focusable = false;
contentLayout.AddView( JoinButton );
JoinButton.Click += (object sender, EventArgs e ) =>
{
ParentAdapter.OnClick( Position, 1 );
};
MeetingTime = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
MeetingTime.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
MeetingTime.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
MeetingTime.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
MeetingTime.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( MeetingTime );
Distance = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Distance.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Distance.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
Distance.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Distance.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Distance );
// add our own custom seperator at the bottom
View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
seperator.LayoutParameters.Height = 2;
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( seperator );
}
示例7: MessageListItem
public MessageListItem( Context context ) : base( context )
{
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
Orientation = Orientation.Vertical;
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
contentLayout.Orientation = Orientation.Horizontal;
AddView( contentLayout );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent );
TitleLayout.Orientation = Orientation.Vertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Title );
Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
TitleLayout.AddView( Date );
Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
Speaker.SetMaxLines( 1 );
TitleLayout.AddView( Speaker );
// add our own custom seperator at the bottom
View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
seperator.LayoutParameters.Height = 2;
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( seperator );
// setup the buttons
LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1;
buttonLayout.Orientation = Orientation.Horizontal;
contentLayout.AddView( buttonLayout );
Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon;
ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
ListenButton.Background = null;
buttonLayout.AddView( ListenButton );
WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon;
WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
WatchButton.Background = null;
buttonLayout.AddView( WatchButton );
TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon;
TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
TakeNotesButton.Background = null;
buttonLayout.AddView( TakeNotesButton );
ListenButton.Click += (object sender, EventArgs e ) =>
{
//.........这里部分代码省略.........
示例8: RefreshStats
private void RefreshStats()
{
LinearLayout txtStats = FindViewById<LinearLayout>(Resource.Id.layoutStats);
txtStats.RemoveAllViews();
foreach (var s in this.Game.lstStats)
{
if (s.Name.ToLower().StartsWith("initial"))
{
}
else
{
string txt = "";
var label = new TextView(this);
txt += s.Name;
txt += ": ";
txt += s.Value;
label.Text = txt;
if(s.IsRed)
{
s.IsRed = false;
label.SetTextColor(Color.Red);
}
if (s.IsGreen)
{
s.IsGreen = false;
label.SetTextColor(Color.Green);
}
label.SetPadding(10, 0, 50, 0);
label.SetTextSize(Android.Util.ComplexUnitType.Dip, 14);
label.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
txtStats.AddView(label);
}
}
if (lstEpizodesQueue.Count > 0)
{
Button btn = new Button(this);
btn.Click += this.ClickBack;
btn.Text = "Back";
btn.Tag = lstEpizodesQueue.Last();
btn.SetTextSize(Android.Util.ComplexUnitType.Dip, 14);
txtStats.AddView(btn);
}
}
示例9: PrepareChances
private void PrepareChances(EpizodeXML epizode, LinearLayout lay)
{
if (epizode.Choices != null)
{
Random rand = new Random(DateTime.Now.Second);
var r = rand.NextDouble();
var chances = epizode.Choices.Chances;
var cnt = chances.Count;
double tillNow = 0;
foreach (var chance in chances)
{
tillNow += chance.Probability;//double.Parse(chance.Attribute(Probability).Value, System.Globalization.NumberStyles.AllowDecimalPoint);
if (r < tillNow)
{
Button btn = new Button(this);
btn.Click += this.Click;
btn.Text = chance.Text;
btn.Tag = chance.GoTo;
btn.SetTextSize(Android.Util.ComplexUnitType.Dip, 14);
lay.AddView(btn);
break;
}
}
}
}
示例10: CreateRollBackButton
private void CreateRollBackButton(Decision chance, LinearLayout lay)
{
Button btn = new Button(this);
btn.Click += this.ClickRollBack;
btn.Text = chance.Text;
btn.Tag = chance.GoTo;
btn.SetTextSize(Android.Util.ComplexUnitType.Dip, 14);
lay.AddView(btn);
}
示例11: RenderMail
private void RenderMail(Array TRs)
{
Loading("");
Refresh = "Mail";
RunOnUiThread (() =>
{
SetContentView(Resource.Layout.Mail);
LinearLayout Main = FindViewById<LinearLayout>(Resource.Id.MyMainLayout);
RelativeLayout RemoveMe = FindViewById<RelativeLayout>(Resource.Id.RemoveMe);
Main.RemoveView(RemoveMe);
Button BLogout = FindViewById<Button>(Resource.Id.Back);
BLogout.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => Logout()); };
Button BCompose = FindViewById<Button>(Resource.Id.Compose);
BCompose.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => Compose()); };
int CNT = 0;
RelativeLayout.LayoutParams MyPars;
foreach (HtmlNode TR in TRs)
{
CNT++;
if (CNT <= 2 || CNT == TRs.Length)
continue;
string HTML = TR.InnerHtml;
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(HTML);
HtmlNode node = doc.DocumentNode;
HtmlNode a = node.Descendants("a").Last();
string ID = a.Attributes.First().Value;
ID = ID.Split('=')[1];
string From = a.InnerText;
HtmlNode Temp;
Array Fonts = node.Descendants("font").ToArray();
Temp = (HtmlNode) Fonts.GetValue(2);
string Time = Temp.InnerText;
Temp = (HtmlNode) Fonts.GetValue(3);
string Where = Temp.InnerText;
Temp = (HtmlNode) Fonts.GetValue(4);
string MSG = Regex.Split(Temp.InnerText, "\\\n")[0];
RelativeLayout NewLayout = new RelativeLayout(this);
if (CNT % 2 == 0)
NewLayout.SetBackgroundColor(Color.ParseColor("#F0E68C"));
else
NewLayout.SetBackgroundColor(Color.ParseColor("#D1CD76"));
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.AlignParentLeft);
MyPars.AddRule(LayoutRules.AlignParentTop);
TextView Mittente = new TextView(this)
{ Text = From };
Mittente.Id = 6901;
Mittente.LayoutParameters = MyPars;
Mittente.SetTextColor(Color.Black);
NewLayout.AddView(Mittente);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.AlignParentRight);
MyPars.AddRule(LayoutRules.AlignParentTop);
TextView Locazione = new TextView(this)
{ Text = Where };
Locazione.Id = 6902;
Locazione.LayoutParameters = MyPars;
Locazione.SetTypeface(Locazione.Typeface, TypefaceStyle.Italic);
Locazione.SetTextColor(Color.Black);
NewLayout.AddView(Locazione);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.CenterHorizontal);
MyPars.AddRule(LayoutRules.Below, 6901);
TextView Testo = new TextView(this)
{ Text = MSG };
Testo.Id = 6903;
Testo.LayoutParameters = MyPars;
Testo.SetTypeface(Testo.Typeface, TypefaceStyle.Bold);
Testo.SetTextColor(Color.Black);
NewLayout.AddView(Testo);
MyPars = new RelativeLayout.LayoutParams(150, 45);
MyPars.AddRule(LayoutRules.AlignParentLeft);
MyPars.AddRule(LayoutRules.Below, 6903);
Button Leggi = new Button(this)
{ Text = "Leggi" };
Leggi.Id = 6904;
Leggi.LayoutParameters = MyPars;
Leggi.SetBackgroundResource(Resource.Drawable.LotButton);
Leggi.SetTextColor(Color.White);
Leggi.SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
Leggi.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => ReadMail(ID)); };
NewLayout.AddView(Leggi);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
//.........这里部分代码省略.........
示例12: UpdateButtonTitle
static void UpdateButtonTitle (Button button, FullScheduleCellViewModel viewModel) {
button.SetTextSize (global::Android.Util.ComplexUnitType.Dip, viewModel.IsSelected ? 24 : 48);
button.SetText (viewModel.IsSelected ? "✓" : "○", TextView.BufferType.Normal);
}