public void SetTypeface(Typeface tf, TypefaceStyle style) { if (style > 0) { if (tf == null) { tf = Typeface.DefaultFromStyle(style); } else { tf = Typeface.Create(tf, style); } this.Typeface = tf; // now compute what (if any) algorithmic styling is needed TypefaceStyle typefaceStyle = tf != null ? tf.Style : TypefaceStyle.Normal; TypefaceStyle need = style & ~typefaceStyle; _textPaint.FakeBoldText = ((need & TypefaceStyle.Bold) != 0); _textPaint.TextSkewX = ((need & TypefaceStyle.Italic) != 0 ? -0.25f : 0); } else { _textPaint.FakeBoldText = false; _textPaint.TextSkewX = 0; this.Typeface = tf; } }
public ViewGroup GetUserView(Context context) { if (layout == null) { layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; subGroupNameView = new TextView(context); subGroupNameView.SetTextSize(ComplexUnitType.Dip, 15); subGroupNameView.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); subGroupNameView.Gravity = GravityFlags.Center; layout.AddView(subGroupNameView); elementCountView = new TextView(context); elementCountView.SetPaddingRelative(0, 5, 0, 0); elementCountView.SetTextSize(ComplexUnitType.Dip, 12); elementCountView.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); elementCountView.Gravity = GravityFlags.Center; layout.AddView(elementCountView); charecteristicsView = new TextView(context); charecteristicsView.SetTextSize(ComplexUnitType.Dip, 12); charecteristicsView.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); charecteristicsView.Gravity = GravityFlags.Center; charecteristicsView.Text = "Characteristics"; layout.AddView(charecteristicsView); listView = new ListView(context); listView.Divider = null; listView.TranscriptMode = TranscriptMode.Disabled; layout.AddView(listView); } subGroupNameView.Text = this.SubGroupName; elementCountView.Text = "No. of Elements: " + this.ElementsCount; List <string> dataList = new List <string>(); foreach (var characteristics in CharacteristicsList) { dataList.Add(characteristics); } ArrayAdapter <string> adapter = new ArrayAdapter <string>(context, Resource.Layout.text_list, dataList); listView.Adapter = adapter; return(layout); }
public ViewGroup GetUserView(Context context) { if (layout == null) { layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; groupNameView = new TextView(context); groupNameView.SetTextSize(ComplexUnitType.Dip, 18); groupNameView.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); groupNameView.Gravity = GravityFlags.Center; layout.AddView(groupNameView); TextView subGroupNameView = new TextView(context); subGroupNameView.SetTextSize(ComplexUnitType.Dip, 12); subGroupNameView.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); subGroupNameView.Gravity = GravityFlags.Center; subGroupNameView.SetPaddingRelative(0, 5, 0, 0); subGroupNameView.Text = "Sub Groups"; layout.AddView(subGroupNameView); listView = new ListView(context); listView.Divider = null; listView.TranscriptMode = TranscriptMode.Disabled; layout.AddView(listView); } groupNameView.Text = this.GroupName; List <string> subGroupNameList = new List <string>(); foreach (var subGroup in SubGroups) { subGroupNameList.Add(subGroup.SubGroupName + "(" + subGroup.ElementsCount + ")"); } ArrayAdapter <string> adapter = new ArrayAdapter <string>(context, Resource.Layout.text_list, subGroupNameList); listView.Adapter = adapter; return(layout); }
public ViewGroup GetUserView(Context context) { if (layout == null) { layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; symbol = new TextView(context); symbol.SetTextSize(ComplexUnitType.Dip, 18); symbol.Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold); symbol.Gravity = GravityFlags.Center; layout.AddView(symbol); name = new TextView(context); name.SetTextSize(ComplexUnitType.Dip, 16); name.Gravity = GravityFlags.Center; layout.AddView(name); atomicNumber = new TextView(context); atomicNumber.SetTextSize(ComplexUnitType.Dip, 12); atomicNumber.SetPaddingRelative(0, 10, 0, 0); atomicNumber.Gravity = GravityFlags.Center; layout.AddView(atomicNumber); atomicWeight = new TextView(context); atomicWeight.SetTextSize(ComplexUnitType.Dip, 12); atomicWeight.Gravity = GravityFlags.Center; layout.AddView(atomicWeight); } symbol.Text = this.Symbol; name.Text = this.ElementName; atomicNumber.Text = "AtomicNumber: " + this.AtomicNumber; atomicWeight.Text = "AtomicWeight: " + this.AtomicWeight; return(layout); }
private Typeface GetTypeface() { var tf = Typeface.DefaultFromStyle(TypefaceStyle.Normal); switch (label.FontAttributes) { case FontAttributes.None: tf = Typeface.DefaultFromStyle(TypefaceStyle.Normal); break; case FontAttributes.Bold: tf = Typeface.DefaultFromStyle(TypefaceStyle.Bold); break; case FontAttributes.Italic: tf = Typeface.DefaultFromStyle(TypefaceStyle.Italic); break; default: tf = Typeface.DefaultFromStyle(TypefaceStyle.Normal); break; } return(tf); }
void BuildUI(Bundle savedInstanceState) { var hMargin = 20; RequestWindowFeature(WindowFeatures.NoTitle); Title = state.Service.ShareTitle; layout = new LinearLayout(this) { Orientation = Orientation.Vertical, }; layout.SetBackgroundColor(Color.White); SetContentView(layout); // // Toolbar // toolbar = new ToolbarView(this, Title); toolbar.IsProgressing = state.IsSending; toolbar.Clicked += (sender, args) => StartSending(); layout.AddView(toolbar); // // Scroll content // var scroller = new ScrollView(this) { LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) { }, }; var scrollContent = new LinearLayout(this) { Orientation = Orientation.Vertical, LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) { }, }; scroller.ScrollbarFadingEnabled = true; scroller.AddView(scrollContent); layout.AddView(scroller); // // Account // var acctLabel = new TextView(this) { Text = "From", LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) { RightMargin = 12, }, }; acctLabel.SetTextColor(Color.DarkGray); acctLabel.SetTextSize(ComplexUnitType.Sp, LabelTextSize); acctPicker = new TextView(this) { Typeface = Typeface.DefaultFromStyle(TypefaceStyle.Bold), Clickable = true, }; acctPicker.SetTextColor(Color.Black); acctPicker.SetTextSize(ComplexUnitType.Sp, LabelTextSize); acctPicker.Click += PickAccount; UpdateAccountUI(); var acctLayout = new LinearLayout(this) { Orientation = Orientation.Horizontal, LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 24, LeftMargin = hMargin, RightMargin = hMargin, }, }; acctLayout.SetGravity(GravityFlags.Left); acctLayout.AddView(acctLabel); acctLayout.AddView(acctPicker); scrollContent.AddView(acctLayout); // // Attachments // var attachLayout = new LinearLayout(this) { Orientation = Orientation.Vertical, Visibility = state.Item.HasAttachments ? ViewStates.Visible : ViewStates.Gone, LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 30, LeftMargin = hMargin, RightMargin = hMargin, }, }; foreach (var x in state.Item.Links) { attachLayout.AddView(new AttachmentView(this, x.AbsoluteUri)); } foreach (var x in state.Item.Images) { attachLayout.AddView(new AttachmentView(this, x.Filename, x.Length)); } foreach (var x in state.Item.Files) { attachLayout.AddView(new AttachmentView(this, x.Filename, x.Length)); } scrollContent.AddView(attachLayout); // // Composer // composer = new EditText(this) { Id = 301, Text = savedInstanceState != null?savedInstanceState.GetString("ComposerText") : state.Item.Text, LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 24, LeftMargin = hMargin - 14, RightMargin = hMargin - 14, }, }; composer.SetTextSize(ComplexUnitType.Sp, ComposeTextSize); composer.SetTextColor(Color.Black); composer.SetBackgroundColor(Color.White); composer.AfterTextChanged += delegate { UpdateRemainingTextUI(); }; scrollContent.AddView(composer); remaining = new TextView(this) { LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 2, LeftMargin = hMargin, RightMargin = hMargin, }, }; remaining.SetTextSize(ComplexUnitType.Sp, ComposeTextSize); UpdateRemainingTextUI(); scrollContent.AddView(remaining); }
public Font(float size, FontStyle style = 0) { nativeTypeface = Typeface.DefaultFromStyle(GetFontStyle(style)); nativeSize = size; }
protected override void SetValue(TypefaceStyle value) { Target.Typeface = Typeface.DefaultFromStyle(value); }