本文整理汇总了C#中Android.Widget.TextView.SetTypeface方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetTypeface方法的具体用法?C# TextView.SetTypeface怎么用?C# TextView.SetTypeface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetTypeface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyCustomFont
//applies font from XML
public static void ApplyCustomFont(TextView view, Context context, IAttributeSet attrs)
{
TypedArray attributeArray = context.ObtainStyledAttributes (attrs, Resource.Styleable.CustomFont);
string fontName = attributeArray.GetString (Resource.Styleable.CustomFont_font);
int textStyle = attrs.GetAttributeIntValue (ANDROID_SCHEMA, "textStyle", 0);
Typeface customFont = SelectTypeface (context, fontName);
switch (textStyle) {
case 1:
view.SetTypeface (customFont, TypefaceStyle.Bold);
break;
case 2:
view.SetTypeface (customFont, TypefaceStyle.Italic);
break;
case 3:
view.SetTypeface (customFont, TypefaceStyle.BoldItalic);
break;
default:
view.SetTypeface (customFont, TypefaceStyle.Normal);
break;
}
attributeArray.Recycle ();
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.dashboard_listview_detail);
progress = new ProgressDialog (this);
lat = 37.09035962;
lan = -95.71368456;
flag = FindViewById<ImageView> (Resource.Id.ivNew1);
flag.Click += Flag_Click;
ivListEmpty = FindViewById<LinearLayout> (Resource.Id.ivEmptylist);
lvlist = FindViewById<ListView> (Resource.Id.lvListDetail);
llMap = FindViewById<RelativeLayout> (Resource.Id.llmap);
tvnumber = FindViewById<TextView> (Resource.Id.tvNumber);
tvdesc = FindViewById<TextView> (Resource.Id.tvdesc);
tvtime = FindViewById<TextView> (Resource.Id.tvTime);
tvreply = FindViewById<TextView> (Resource.Id.tvReply);
ListSipp = new List<SippReplyModel> ();
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf");
Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf");
Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf");
adapter = new CustomListViewDetail (this, ListSipp);
lvlist.Adapter = adapter;
if (adapter.IsEmpty) {
ivListEmpty.Visibility = ViewStates.Visible;
} else {
ivListEmpty.Visibility = ViewStates.Gone;
}
mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
map = mapFrag.Map;
map.UiSettings.CompassEnabled = true;
map.UiSettings.ZoomControlsEnabled = false;
map.MyLocationEnabled = false;
LatLng lastLatLng = new LatLng (lat, lan);
map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15));
MarkerOptions marker = new MarkerOptions ();
marker.SetPosition (new LatLng (lat, lan));
map.AddMarker (marker);
llMap.Background.SetAlpha (200);
llMap.Click += LlMap_Click;
tvnumber.SetTypeface (tf, TypefaceStyle.Normal);
tvnumber.SetTypeface (tf2, TypefaceStyle.Normal);
tvtime.SetTypeface (tf1, TypefaceStyle.Normal);
tvreply.SetTypeface (tf1, TypefaceStyle.Normal);
}
示例3: AddItem
//here we only have img and text for each item
//create a RelativeLayout and add it to dic
//squear image
public void AddItem(int imgresource,string text,Action OnCellClick)
{
RelativeLayout menucell = new RelativeLayout (nn_context);
menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding));
menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight));
menucell.Click+= (object sender, EventArgs e) => {
if(OnCellClick!=null){
OnCellClick();
}
};
ImageView img = new ImageView (nn_context);
img.Id = TapUtil.generateViewId ();
img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth));
// Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false);
img.SetImageResource (imgresource);
img.SetBackgroundColor (Color.White);
TextView textview = new TextView (nn_context);
RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight));
textviewparam.AddRule(LayoutRules.RightOf,img.Id);
textviewparam.LeftMargin = TapUtil.dptodx (space);
textview.LayoutParameters =textviewparam;
textview.Text = text;
textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
textview.SetTextColor(Color.Black);
textview.Gravity = global::Android.Views.GravityFlags.Center;
menucell.AddView (img);
menucell.AddView (textview);
nn_itemlist.Add (menucell);
}
示例4: StyleUILabel
public static void StyleUILabel( TextView label, string font, uint size )
{
label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
label.SetBackgroundColor( Android.Graphics.Color.Transparent );
label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal );
label.SetTextSize( Android.Util.ComplexUnitType.Dip, size );
}
示例5: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf");
_tvDescription = FindViewById<TextView> (Resource.Id.tvDescription);
_tvDescription.SetTypeface (tf, TypefaceStyle.Normal);
_tvContinue = FindViewById<TextView> (Resource.Id.tvContinue);
_tvContinue.Click += Continue_Click;
InitializeLocationManager();
}
示例6: SetLinkView
private void SetLinkView()
{
_boardGameButton = FindViewById<TextView>(Resource.Id.BoardGame);
_boardGameButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed),
TypefaceStyle.Normal);
var webLinkText = @"<a href='http://www.spb.mosigra.ru/Face/Show/ersh'>"
+ GetString(Resource.String.BoardGameString)
+ "</a>";
var textFormated = Html.FromHtml(webLinkText);
_boardGameButton.TextFormatted = textFormated;//your html goes in responseText
_boardGameButton.Clickable = true;
}
示例7: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.more_activity);
//this.ActionBar.Hide ();
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Regular.ttf");
Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf");
Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf");
tvTopYak = FindViewById<TextView> (Resource.Id.tvtopyak);
tvTopYakArea = FindViewById<TextView> (Resource.Id.tvtopyakArea);
tvOhterYak = FindViewById<TextView> (Resource.Id.tvOhteryak);
tvLoveYak = FindViewById<TextView> (Resource.Id.tvloveyak);
tvShare = FindViewById<TextView> (Resource.Id.tvShareYak);
tvRate = FindViewById<TextView> (Resource.Id.tvRateYak);
tvTwitter = FindViewById<TextView> (Resource.Id.tvTwitter);
tvFacebook = FindViewById<TextView> (Resource.Id.tvFacebook);
tvInstagram = FindViewById<TextView> (Resource.Id.tvinstagram);
tvfind = FindViewById<TextView> (Resource.Id.tvFind);
tvImportant = FindViewById<TextView> (Resource.Id.tvImportant);
tvTopYak.SetTypeface (tf2, TypefaceStyle.Normal);
tvTopYakArea.SetTypeface (tf, TypefaceStyle.Normal);
tvOhterYak.SetTypeface (tf, TypefaceStyle.Normal);
tvLoveYak.SetTypeface (tf1, TypefaceStyle.Normal);
tvShare.SetTypeface (tf, TypefaceStyle.Normal);
tvRate.SetTypeface (tf, TypefaceStyle.Normal);
tvTwitter.SetTypeface (tf, TypefaceStyle.Normal);
tvInstagram.SetTypeface (tf, TypefaceStyle.Normal);
tvInstagram.SetTypeface (tf, TypefaceStyle.Normal);
tvfind.SetTypeface (tf, TypefaceStyle.Normal);
tvImportant.SetTypeface (tf, TypefaceStyle.Normal);
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our UI controls from the loaded layout:
submitButton = FindViewById<Button>(Resource.Id.Button1);
InputText = FindViewById<EditText>(Resource.Id.TextInput1);
DisplayText = FindViewById<EditText>(Resource.Id.TextView1);
FontinBold = FindViewById<CheckBox> (Resource.Id.BoldChecked);
FontinItalic = FindViewById<CheckBox> (Resource.Id.ItalicChecked);
InputText.Text = "";
// Get our button from the layout resource,
// and attach an event to it
submitButton.Click += (object sender, EventArgs e) =>
{
//Set the font type depend on the options selected
if ((FontinBold.Checked) && (FontinItalic.Checked))
DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.BoldItalic);
else if (FontinBold.Checked)
DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Bold);
else if (FontinItalic.Checked)
DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Italic);
else DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Normal);
//Echo the word into output field
if (String.IsNullOrWhiteSpace(InputText.Text))
DisplayText.Text = "Nothing was entered";
else
DisplayText.Text = "You entered: " + InputText.Text;
};
}
示例9: 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);
}
}
示例10: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
TextView button = new TextView(context);
button.SetText(chapters[position], TextView.BufferType.Normal);
button.TextSize = 32;
button.SetTypeface(ThisApp.Font(context, "ionbold"), Android.Graphics.TypefaceStyle.Normal);
button.SetHeight(84);
button.SetBackgroundResource(Resource.Drawable.metro_button_style);
button.Gravity = GravityFlags.Center;
//button.SetPadding(0, 0, 0, 0);
//button.SetTextColor(Resources.System.GetColorStateList(Resource.Color.metro_button_text_style));
//button.SetTextColor(Resources.System.GetColor(Resource.Color.metro_button_text_style));
button.Id = position;
button.Click += button_Click;
return button;
}
示例11: 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);
contenLayout = new LinearLayout (context);
contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
contenLayout.Orientation = Orientation.Vertical;
titleHeader = new TextView (context);
content = new TextView (context);
titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
//titleHeader.Text = "El Perú cuenta con mas de 357000 tipos de aves";
titleHeader.SetTypeface(null,TypefaceStyle.Bold);
//titleHeader.SetTextSize (textFormat, Configuration.getHeight (52));
titleHeader.SetTextSize (textFormatdip, 27.0f);
titleHeader.SetMaxWidth (Configuration.getWidth (583));
//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 pájaros(segun la lista oficial del SACC/CRAP), tambien es considerado el";
// content.SetTextSize (textFormat, Configuration.getHeight (26));
content.SetTextSize (textFormatdip, 12.0f);
content.SetMaxWidth (Configuration.getWidth(583));
contenLayout.AddView (titleHeader);
contenLayout.AddView(content);
//contenLayout.SetX (Configuration.getHeight (45));
int padW = Configuration.getWidth(45);
int padH = Configuration.getHeight (15);
//contenLayout.SetPadding (padW,padH,padW,padH);
//contenLayout.SetY (Configuration.getWidth (12));
mainLayout.SetPadding (padW,padH,padW,padH);
mainLayout.AddView(contenLayout);
}
示例12: GetSampleContent
public override Android.Views.View GetSampleContent(Context context)
{
sfGrid = new SfDataGrid(context);
viewModel = new ExportingViewModel();
sfGrid.AutoGeneratingColumn += GridGenerateColumns;
sfGrid.ItemsSource = (viewModel.OrdersInfo);
exportPdf = new ImageButton(context);
exportPdf.SetMaxHeight(30);
exportPdf.SetMaxWidth(30);
exportPdf.SetBackgroundColor(Android.Graphics.Color.Transparent);
exportPdf.SetImageResource(Resource.Drawable.pdfexport);
exportPdf.SetScaleType(ImageView.ScaleType.FitXy);
exportPdf.LayoutParameters = new ViewGroup.LayoutParams( 120,120);
exportPdf.Click += ExportToPdf;
exportExcel = new ImageButton(context);
exportExcel.SetMaxHeight(30);
exportExcel.SetMaxWidth(30);
exportExcel.SetBackgroundColor(Android.Graphics.Color.Transparent);
exportExcel.SetImageResource(Resource.Drawable.excelexport);
exportExcel.SetScaleType(ImageView.ScaleType.FitXy);
exportExcel.LayoutParameters = new ViewGroup.LayoutParams(120, 120);
exportExcel.Click += ExportToExcel;
LinearLayout option = new LinearLayout(context);
option.SetGravity(GravityFlags.Center);
option.Orientation = Android.Widget.Orientation.Horizontal;
var pdftext = new TextView(context) { Text = "Export to Pdf" };
pdftext.SetTypeface(null, TypefaceStyle.Bold);
var exceltext = new TextView(context) { Text = "Export to Excel" };
exceltext.SetTypeface(null, TypefaceStyle.Bold);
option.AddView(exportPdf);
option.AddView(pdftext);
option.AddView(exportExcel);
option.AddView(exceltext);
LinearLayout mainView = new LinearLayout(context);
mainView.Orientation = Android.Widget.Orientation.Vertical;
mainView.AddView(option);
mainView.AddView(sfGrid);
return mainView;
}
示例13: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.sendsipper);
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf");
// Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf");
// Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf");
// wifiManager = (WifiManager)this.GetSystemService (WifiService);
// ip = Convert.ToString (wifiManager.ConnectionInfo.IpAddress);
//Console.WriteLine ("ip address : " + ip);
tvcancel = FindViewById<TextView> (Resource.Id.tvCancel);
tvdata = FindViewById<EditText> (Resource.Id.tvdata);
tvsend = FindViewById<TextView> (Resource.Id.tvSend);
tvcancel.SetTypeface (tf, TypefaceStyle.Normal);
tvdata.SetTypeface (tf, TypefaceStyle.Normal);
tvsend.SetTypeface (tf, TypefaceStyle.Normal);
tvcancel.Click += (object sender, EventArgs e) => Finish ();
tvsend.Click += Tvsend_Click;
}
示例14: 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);
}
}
示例15: OnCreateView
public void OnCreateView( View parentView )
{
Layout = parentView.FindViewById<RelativeLayout>( LayoutId );
Icon = Layout.FindViewById<TextView>( Resource.Id.icon );
Button = Layout.FindViewById<Button>( Resource.Id.button );
Text = Layout.FindViewById<TextView>( Resource.Id.text );
Typeface fontFace = FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary );
Icon.SetTypeface( fontFace, TypefaceStyle.Normal );
Icon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.Element_FontSize );
Icon.SetX( Icon.GetX() - Icon.Width / 2 );
Icon.Text = IconStr;
Text.Text = ElementLabel;
Text.SetTypeface( FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Text.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Button.Background = null;
// setup the seperator color
View seperator = Layout.FindViewById<View>( Resource.Id.seperator );
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
}