本文整理汇总了C#中Android.Widget.TextView.SetBackgroundDrawable方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetBackgroundDrawable方法的具体用法?C# TextView.SetBackgroundDrawable怎么用?C# TextView.SetBackgroundDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetBackgroundDrawable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NodeClick
/**
* 节点浏览示例
* @param v
*/
public void NodeClick(View v)
{
if (nodeIndex < -1 || route == null || nodeIndex >= route.NumSteps)
return;
viewCache = LayoutInflater.Inflate(Resource.Layout.custom_text_view, null);
popupText = viewCache.FindViewById<TextView>(Resource.Id.textcache);
//上一个节点
if (mBtnPre.Equals(v) && nodeIndex > 0)
{
//索引减
nodeIndex--;
//移动到指定索引的坐标
mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
//弹出泡泡
popupText.Text = route.GetStep(nodeIndex).Content;
popupText.SetBackgroundResource(Resource.Drawable.popup);
pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
route.GetStep(nodeIndex).Point,
5);
}
//下一个节点
if (mBtnNext.Equals(v) && nodeIndex < (route.NumSteps - 1))
{
//索引加
nodeIndex++;
//移动到指定索引的坐标
mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
//弹出泡泡
popupText.Text = route.GetStep(nodeIndex).Content;
popupText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.popup));
pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
route.GetStep(nodeIndex).Point,
5);
}
}
示例2: SetTheme
public static void SetTheme(TextView textView, FlatTheme theme,
FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, int textColor, int backgroundColor,
int customBackgroundColor, int cornerRadius)
{
if (backgroundColor != -1)
{
var bgColor = theme.DarkAccentColor;
if (backgroundColor == 0)
bgColor = theme.DarkAccentColor;
else if (backgroundColor == 1)
bgColor = theme.BackgroundColor;
else if (backgroundColor == 2)
bgColor = theme.LightAccentColor;
else if (backgroundColor == 3)
bgColor = theme.VeryLightAccentColor;
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.SetColor(bgColor);
gradientDrawable.SetCornerRadius(cornerRadius);
textView.SetBackgroundDrawable(gradientDrawable);
}
else if (customBackgroundColor != -1)
{
var bgColor = theme.DarkAccentColor;
if (customBackgroundColor == 0)
bgColor = theme.DarkAccentColor;
else if (customBackgroundColor == 1)
bgColor = theme.BackgroundColor;
else if (customBackgroundColor == 2)
bgColor = theme.LightAccentColor;
else if (customBackgroundColor == 3)
bgColor = theme.VeryLightAccentColor;
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.SetColor(bgColor);
gradientDrawable.SetCornerRadius(cornerRadius);
textView.SetBackgroundDrawable(gradientDrawable);
}
var txtColor = theme.VeryLightAccentColor;
if (textColor == 0)
txtColor = theme.DarkAccentColor;
if (textColor == 1)
txtColor = theme.BackgroundColor;
if (textColor == 2)
txtColor = theme.LightAccentColor;
if (textColor == 3)
txtColor = theme.VeryLightAccentColor;
textView.SetTextColor(txtColor);
var typeface = FlatUI.GetFont(textView.Context, fontFamily, fontWeight);
if (typeface != null)
textView.SetTypeface(typeface, TypefaceStyle.Normal);
}
示例3: Init
private void Init()
{
RemoveAllViews();
Orientation = Orientation.Horizontal;
LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
lp.Gravity = GravityFlags.CenterVertical;
LayoutParameters = lp;
cardImageLayout = new FrameLayout(Context);
LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
cardImageLayoutParams.Gravity = GravityFlags.CenterVertical;
cardImageLayout.LayoutParameters = cardImageLayoutParams;
cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);
SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);
cv2TextView = new CV2TextView(Context);
LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
parameters.Weight = 1;
parameters.Gravity = GravityFlags.Center;
cv2TextView.LayoutParameters = parameters;
cv2TextView.OnEntryComplete += cardNumber =>
{
if (OnCreditCardEntered != null)
{
OnCreditCardEntered(cardNumber);
}
};
LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);
textViewLayoutParams.Gravity = GravityFlags.Center;
last4CCNosTextView = new TextView(Context);
last4CCNosTextView.Gravity = GravityFlags.Center;
last4CCNosTextView.Text = "0000";
last4CCNosTextView.LayoutParameters = textViewLayoutParams;
last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
last4CCNosTextView.TextSize = 18;
last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
last4CCNosTextView.Focusable = false;
last4CCNosTextView.Enabled = false;
last4CCNosTextView.SetSingleLine();
last4CCNosTextView.SetBackgroundDrawable(null);
AddView(cardImageLayout);
AddView(last4CCNosTextView);
AddView(cv2TextView);
}