本文整理汇总了C#中Button.SetTypeface方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetTypeface方法的具体用法?C# Button.SetTypeface怎么用?C# Button.SetTypeface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.SetTypeface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
private void Initialize()
{
try
{
_isEndGame = Intent.GetBooleanExtra("isEnd", false);
_listView = FindViewById<ListView>(Resource.Id.playerTournamentListView);
var sortedPlayersList = Rep.Instance.Players.Players.OrderByDescending(player => player.Score).ToList();
SetFirstItem(sortedPlayersList.First(), _isEndGame);
sortedPlayersList.RemoveAt(0);
var adapter = new ResultPlayersAdapter(this, sortedPlayersList);
_listView.Adapter = adapter;
_startNewGameButton = FindViewById<Button>(Resource.Id.startNewGameButton);
this.AddButtonTouchListener(_startNewGameButton);
_startNewGameButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_endGameButton = FindViewById<Button>(Resource.Id.endGameButton);
this.AddButtonTouchListener(_endGameButton);
_endGameButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_dialog = new DialogRatingFragment() { ShowsDialog = true };
}
catch (Exception exception)
{
GaService.TrackAppException(this.Class, "Initialize", exception, false);
}
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.AddPlayers);
CreateActionButton (Resource.Drawable.add_player_button).Click+=(sender,e)=>
StartActivity(new Intent(this, typeof(AddNewPlayerActivity)));
_startGameButton = FindViewById<Button>(Resource.Id.startPlayButton);
_startGameButton.Touch += (sender, e) => this.OnTouchButtonDarker (_startGameButton, e);
_startGameButton.SetTypeface (this.MyriadProFont (MyriadPro.BoldCondensed), Android.Graphics.TypefaceStyle.Normal);
}
示例3: 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 ) );
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
try
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.AddPlayers);
CreateActionButton(Resource.Drawable.add_player_button);
_startGameButton = FindViewById<Button>(Resource.Id.startPlayButton);
AddButtonTouchListener(_startGameButton);
_startGameButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_listView = FindViewById<ListView>(Resource.Id.playersList);
RegisterSubscribes();
}
catch (Exception exception)
{
GaService.TrackAppException(this.Class, "OnCreate", exception, false);
}
}
示例5: Initialize
private void Initialize()
{
try
{
_redColor = Resources.GetColor(Resource.Color.task_progress_red);
_greenColor = Resources.GetColor(Resource.Color.task_progress_green);
_playerName = FindViewById<TextView>(Resource.Id.playerInGameName);
_playerPosition = FindViewById<TextView>(Resource.Id.playerInGamePostion);
_playerScore = FindViewById<TextView>(Resource.Id.playerInGameScore);
_makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton);
_refuseButton = FindViewById<Button>(Resource.Id.refuseButton);
_cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton);
_actionButton = (TextView)CreateActionButton(Resource.Drawable.table_button);
_points = FindViewById<TextView>(Resource.Id.points);
_x2 = FindViewById<TextView>(Resource.Id.x2);
_coninueButton = FindViewById<ImageButton>(Resource.Id.continueButton);
_scoreTextView = FindViewById<TextView>(Resource.Id.scoreString);
_taskEnumerator = Rep.DatabaseHelper.Tasks.Enumerator;
_playerEnumerator = Rep.Instance.Players.Enumerator;
_playerName.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
_playerPosition.SetTypeface(Rep.FontManager.Get(Font.Regular), TypefaceStyle.Normal);
_makeThisButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_refuseButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_playerScore.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal);
_points.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
_x2.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal);
_cardImage.SetImageResource(Resource.Drawable.card_backside); ;
_scoreTextView.SetTypeface(Rep.FontManager.Get(Font.Condensed), TypefaceStyle.Normal);
_taskProgressView = FindViewById<RelativeLayout>(Resource.Id.taskProgressView);
}
catch (Exception exception)
{
GaService.TrackAppException(this.Class, "Initialize", exception, true);
}
}
示例6: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.Inflate(Resource.Layout.SearchActivity, container, false);
View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Search";
ImageView toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft);
toolbarImageFarLeft.Visibility = ViewStates.Visible;
Drawable backArrow = Context.Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
backArrow.SetColorFilter(Resources.GetColor(Resource.Color.tenBlue), PorterDuff.Mode.SrcAtop);
toolbarImageFarLeft.SetImageDrawable(backArrow);
toolbarImageFarLeft.Click += (sender, e) =>
{
ViewUtils.HideKeyboard(Activity, searchField);
FragmentManager.PopBackStack();
};
usersButton = (Button)view.FindViewById(Resource.Id.users);
usersButton.Click += delegate
{
usersButton.SetTypeface(null, TypefaceStyle.Bold);
tagsButton.SetTypeface(null, TypefaceStyle.Normal);
searchType = "user";
FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container_search, ListOfFeedFragment).Commit();
};
tagsButton = (Button)view.FindViewById(Resource.Id.tags);
tagsButton.Click += delegate
{
tagsButton.SetTypeface(null, TypefaceStyle.Bold);
usersButton.SetTypeface(null, TypefaceStyle.Normal);
searchType = "post";
FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container_search, PostFeedFragment).Commit();
};
PostFeedFragment = new PostFeedFragment();
PostFeedFragment.EmptyTableString = Strings.no_active_posts;
PostFeedFragment.Master = this;
PostFeedFragment.Target = FeedTypeEnum.FeedType.SearchHashFeed;
ListOfFeedFragment = new ListOfFeedFragment();
ListOfFeedFragment.EmptyTableString = Strings.no_users_found;
ListOfFeedFragment.Master = this;
ListOfFeedFragment.Target = FeedTypeEnum.FeedType.SearchListOfFeed;
usersButton.CallOnClick();
searchField = (EditText)view.FindViewById(Resource.Id.searchfield);
searchField.TextChanged += delegate
{
SearchButtonClicked();
};
string searchString = StringUtils.RemoveAllHashTags(StringUtils.TrimWhiteSpaceAndNewLine(IncommingTagForSearch));
if (!string.IsNullOrEmpty(searchString))
{
tagsButton.CallOnClick();
searchField.Text = searchString;
SearchButtonClicked();
}
return view;
}
示例7: 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 );
}
示例8: Initialize
private void Initialize()
{
_playerName = FindViewById<TextView> (Resource.Id.playerInGameName);
_playerPosition = FindViewById<TextView> (Resource.Id.playerInGamePostion);
_playerScore = FindViewById<TextView> (Resource.Id.playerInGameScore);
_makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton);
_refuseButton = FindViewById<Button>(Resource.Id.refuseButton);
_cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton);
_actionButton = (TextView)CreateActionButton (Resource.Drawable.table_button);
_points = FindViewById<TextView> (Resource.Id.points);
_x2 = FindViewById<TextView> (Resource.Id.x2);
_taskEnumerator = (TaskEnumerator)Rep.Instance.Tasks.GetEnumerator ();
_playerName.SetTypeface(this.MyriadProFont(MyriadPro.Bold),TypefaceStyle.Normal);
_playerPosition.SetTypeface(this.MyriadProFont(MyriadPro.Regular),TypefaceStyle.Normal);
_makeThisButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
_refuseButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
_playerScore.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
_points.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal);
_x2.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal);
_cardImage.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.card_backside));
FindViewById<TextView>(Resource.Id.scoreString).SetTypeface(this.MyriadProFont(MyriadPro.Condensed), TypefaceStyle.Normal);
}
示例9: 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 );
示例10: 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 ) =>
{
//.........这里部分代码省略.........
示例11: 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 );
}
示例12: GenerateButton
private Button GenerateButton(MenuItem item)
{
Button btn = new Button (_context);
btn.Text = item.Text;
var param = new TableLayout.LayoutParams (0, LayoutParams.WrapContent, 1f);
if (margin >= 0) {
marginBottom = marginLeft = marginTop = marginRight = margin;
}
param.BottomMargin = MarginBottom;
param.LeftMargin = MarginLeft;
param.TopMargin = MarginTop;
param.RightMargin = MarginRight;
btn.LayoutParameters = param;
if (item.IconId != 0) {
btn.SetCompoundDrawablesWithIntrinsicBounds (null,
Resources.GetDrawable (item.IconId),
null, null);
}
btn.SetTypeface (tabTypeface, typefaceStyle);
btn.SetTextColor (TextColor);
btn.TextSize = TextSize;
btn.SetBackgroundColor (ItemBgColor);
btn.SetBackgroundResource (ItemBg);
if (padding != 0) {
paddingLeft = paddingTop = paddingRight = paddingBottom = padding;
}
btn.SetPadding (paddingLeft, paddingTop, paddingRight, paddingBottom);
btn.Click += (o, e) => {
if (ItemClicked != null) {
ItemClicked (this, item.ItemId);
}
};
return btn;
}
示例13: SetFont
public static void SetFont(Button button){
button.SetTypeface(typeFace, TypefaceStyle.Normal);
}
示例14: RelationshipsTeamCard
public RelationshipsTeamCard(Context context,int type)
: base(context)
{
nn_context=context;
this.LayoutParameters = new ListView.LayoutParams (ListView.LayoutParams.MatchParent,ListView.LayoutParams.WrapContent);
this.SetPadding (TapUtil.dptodx (10), TapUtil.dptodx (10), TapUtil.dptodx (10), TapUtil.dptodx (10));
titlecontaienr = new LinearLayout (nn_context);
titlecontaienr.Orientation = Orientation.Horizontal;
titlecontaienr.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams titlecontainerparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
titlecontaienr.LayoutParameters = titlecontainerparam;
organizationimg = new ImageView (nn_context);
LinearLayout.LayoutParams organizationimgparam = new LinearLayout.LayoutParams(TapUtil.dptodx(50),TapUtil.dptodx(50));
organizationimgparam.Gravity = GravityFlags.CenterVertical;
organizationimg.LayoutParameters = organizationimgparam;
titleinfocontainer = new LinearLayout (nn_context);
titleinfocontainer.Orientation = Orientation.Vertical;
LinearLayout.LayoutParams titleinfoparam = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
titleinfocontainer.LayoutParameters = titleinfoparam;
eventnametextview = new TextView (nn_context);
eventnametextview.LayoutParameters = new LinearLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
eventnametextview.Gravity = global::Android.Views.GravityFlags.Center;
eventnametextview.Text="eventname";
eventnametextview.TextSize = TapUtil.dptodx (fontsize);
eventnametextview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
organizationnametextview = new TextView (nn_context);
organizationnametextview.LayoutParameters = new LinearLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
organizationnametextview.Gravity = global::Android.Views.GravityFlags.Center;
organizationnametextview.Text="organizationname";
organizationnametextview.TextSize = TapUtil.dptodx (fontsize);
organizationnametextview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
statustextview = new TextView(nn_context);
statustextview.Id = TapUtil.generateViewId();
statustextview.Gravity = GravityFlags.Center;
RelativeLayout.LayoutParams statustextviewparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
statustextviewparam.TopMargin = TapUtil.dptodx(10);
statustextviewparam.AddRule(LayoutRules.Below, titlecontaienr.Id);
statustextview.LayoutParameters = statustextviewparam;
actionscontainer = new LinearLayout (nn_context);
actionscontainer.Orientation = Orientation.Horizontal;
RelativeLayout.LayoutParams actionscontainerparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
actionscontainerparam.TopMargin = TapUtil.dptodx (10);
actionscontainerparam.AddRule (LayoutRules.Below, statustextview.Id);
actionscontainer.LayoutParameters = actionscontainerparam;
// type = 0 pending, type= 1 leader,type=2 member, type=3 no group
if (type == 0)
{
statustextview.SetTextColor(Color.Red);
actionscontainer.Orientation = Orientation.Vertical;
teamnametextview = new TextView(nn_context);
teamnametextview.Gravity = GravityFlags.Center;
teamnametextview.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
teamnametextview.TextSize = TapUtil.dptodx(fontsize);
LinearLayout.LayoutParams teamnametextviewparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
teamnametextviewparam.TopMargin = TapUtil.dptodx(10);
teamleadertextview = new TextView(nn_context);
teamleadertextview.Gravity = GravityFlags.Center;
teamleadertextview.TextSize = TapUtil.dptodx(fontsize);
LinearLayout.LayoutParams teamleadertextviewparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
teamleadertextviewparam.TopMargin = TapUtil.dptodx(10);
actionscontainer.AddView(teamnametextview);
actionscontainer.AddView(teamleadertextview);
}
else if (type == 1) {
statustextview.SetTextColor(Color.Blue);
actionscontainer.Orientation = Orientation.Horizontal;
actionscontainer.SetPadding(TapUtil.dptodx(10), TapUtil.dptodx(10), TapUtil.dptodx(10), TapUtil.dptodx(10));
var button1container = new LinearLayout(nn_context);
var button1containerparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
button1containerparam.Weight = 1;
button1container.LayoutParameters = button1containerparam;
button1container.SetPadding(TapUtil.dptodx(5), TapUtil.dptodx(5), TapUtil.dptodx(5), TapUtil.dptodx(5));
button1container.SetGravity(GravityFlags.Center);
invitebutton = new Button(nn_context);
LinearLayout.LayoutParams invitebuttonparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
invitebutton.LayoutParameters = invitebuttonparam;
invitebutton.SetBackgroundResource(Resource.Color.iosblue);
invitebutton.SetTextColor(Color.White);
invitebutton.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
button1container.AddView(invitebutton);
//.........这里部分代码省略.........
示例15: SetTheme
public static void SetTheme(Button button, FlatTheme theme, FlatUI.FlatTextAppearance textAppearance,
FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, bool isFullFlat, int padding, int radius)
{
var bottom = 5;
float[] outerR = {radius, radius, radius, radius, radius, radius, radius, radius};
// creating normal state drawable
var normalFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));
normalFront.Paint.Color = theme.LightAccentColor;
normalFront.SetPadding(padding, padding, padding, padding);
var normalBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));
normalBack.Paint.Color = theme.BackgroundColor;
if (isFullFlat)
bottom = 0;
normalBack.SetPadding(0, 0, 0, bottom);
Drawable[] d = {normalBack, normalFront};
var normal = new LayerDrawable(d);
// creating pressed state drawable
var pressedFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));
pressedFront.Paint.Color = theme.BackgroundColor;
var pressedBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));
pressedBack.Paint.Color = theme.DarkAccentColor;
if (!isFullFlat)
pressedBack.SetPadding(0, 0, 0, 3);
Drawable[] d2 = {pressedBack, pressedFront};
var pressed = new LayerDrawable(d2);
// creating disabled state drawable
var disabledFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));
disabledFront.Paint.Color = theme.VeryLightAccentColor;
var disabledBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));
disabledBack.Paint.Color = theme.LightAccentColor;
if (!isFullFlat) disabledBack.SetPadding(0, 0, 0, padding);
Drawable[] d3 = {disabledBack, disabledFront};
var disabled = new LayerDrawable(d3);
var states = new StateListDrawable();
states.AddState(new []{ Android.Resource.Attribute.StatePressed, Android.Resource.Attribute.StateEnabled }, pressed);
states.AddState(new []{ Android.Resource.Attribute.StateFocused, Android.Resource.Attribute.StateEnabled }, pressed);
states.AddState(new []{ Android.Resource.Attribute.StateEnabled }, normal);
states.AddState(new []{-Android.Resource.Attribute.StateEnabled}, disabled);
button.SetBackgroundDrawable (states);
if (textAppearance == FlatUI.FlatTextAppearance.Dark)
button.SetTextColor(theme.DarkAccentColor);
else if (textAppearance == FlatUI.FlatTextAppearance.Light)
button.SetTextColor(theme.VeryLightAccentColor);
else
button.SetTextColor(Android.Graphics.Color.White);
var typeface = FlatUI.GetFont(button.Context, fontFamily, fontWeight);
if (typeface != null)
button.SetTypeface(typeface, Android.Graphics.TypefaceStyle.Normal);
}