本文整理汇总了C#中EditText.SetTextAppearance方法的典型用法代码示例。如果您正苦于以下问题:C# EditText.SetTextAppearance方法的具体用法?C# EditText.SetTextAppearance怎么用?C# EditText.SetTextAppearance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditText
的用法示例。
在下文中一共展示了EditText.SetTextAppearance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
private void Init()
{
base.RemoveAllViews();
hintTextView = new EditText(Context);
textTextView = new NoCursorMovingEditText(Context, BackKeyPressed);
linearLayout = new LinearLayout(Context);
linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight());
textLayout = new RelativeLayout(Context);
textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1);
textLayout.SetGravity(GravityFlags.Center);
linearLayout.AddView(textLayout);
textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText);
LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.WrapContent);
lp.AddRule(LayoutRules.CenterVertical);
hintTextView.LayoutParameters = lp;
textTextView.LayoutParameters = lp;
hintTextView.Enabled = false;
hintTextView.Focusable = false;
textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
int horizontalPadding =
Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding);
hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0);
textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0);
textErrorView = new EditText(Context);
RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent,
LayoutParams.WrapContent);
errorLP.AddRule(LayoutRules.CenterVertical);
int margin = UiUtils.ToPixels(Context, 2);
errorLP.SetMargins(margin, 0, margin, 0);
textErrorView.LayoutParameters = errorLP;
textErrorView.Enabled = false;
textErrorView.Focusable = false;
textErrorView.Visibility = ViewStates.Gone;
textErrorView.SetBackgroundColor(Color.Red);
int errorVerticalPadding =
Context.Resources.GetDimensionPixelOffset(
Resource.Dimension.backgroundhinttextview_error_vertical_padding);
textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding);
textErrorView.Text = errorText;
textErrorView.SetSingleLine(true);
textErrorView.Gravity = GravityFlags.Center;
textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText);
//set courier font
Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
//hintTextView.Typeface = type;
hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
//textTextView.Typeface = type;
textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
textErrorView.Typeface = type;
textLayout.AddView(hintTextView);
textLayout.AddView(textTextView);
AddView(linearLayout);
IEnumerable<char> previousCharSequence;
EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) =>
{
previousCharSequence = args.Text;
};
EventHandler<TextChangedEventArgs> textChanged = (sender, args) =>
{
beforeTextSize = args.BeforeCount;
};
EventHandler<AfterTextChangedEventArgs> afterTextChanged = null;
Action<string> updateTextView = newText =>
{
textTextView.TextChanged -= textChanged;
textTextView.BeforeTextChanged -= beforeTextChanged;
textTextView.AfterTextChanged -= afterTextChanged;
textTextView.Text = newText;
textTextView.TextChanged += textChanged;
textTextView.BeforeTextChanged += beforeTextChanged;
textTextView.AfterTextChanged += afterTextChanged;
};
//.........这里部分代码省略.........
示例2: AddFixedText
public void AddFixedText(string text)
{
EditText fixedText = new EditText(Context);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
layoutParams.Gravity = GravityFlags.CenterVertical;
fixedText.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
fixedText.LayoutParameters = layoutParams;
fixedText.Enabled = false;
fixedText.Focusable = false;
fixedText.Text = text;
fixedText.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
fixedText.SetPadding(0,0,0,0);
Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
fixedText.Typeface = type;
if (linearLayout.ChildCount > 1)
{
linearLayout.RemoveViewAt(0);
}
linearLayout.AddView(fixedText, 0);
}