本文整理汇总了C#中Android.Widget.TextView.SetTextAppearance方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetTextAppearance方法的具体用法?C# TextView.SetTextAppearance怎么用?C# TextView.SetTextAppearance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetTextAppearance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
// [END mListener_variable_reference]
// [START auth_oncreate_setup_beginning]
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
// Put application specific code here.
// [END auth_oncreate_setup_beginning]
SetContentView (Resource.Layout.activity_main);
logView = FindViewById<TextView> (Resource.Id.sample_logview);
logView.SetTextAppearance (this, Resource.Style.Log);
logView.SetBackgroundColor (Android.Graphics.Color.White);
logView.Append ("\r\n");
// [START auth_oncreate_setup_ending]
if (savedInstanceState != null)
authInProgress = savedInstanceState.GetBoolean (AUTH_PENDING);
buildFitnessClient();
}
示例2: GetRow
TableRow GetRow(string attr, string value)
{
TableRow row = new TableRow (this.Activity);
TextView attrName = new TextView (this.Activity);
// attrName.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
attrName.SetTextAppearance(Activity, Resource.Style.text_row);
attrName.SetPadding(6, 6, 6, 0);
attrName.Text = attr;
row.AddView (attrName);
TextView attrValue = new TextView (this.Activity);
// attrName.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
attrValue.SetTextAppearance(Activity, Resource.Style.text_row);
attrValue.SetPadding(6, 6, 6, 0);
attrValue.Text = value;
row.AddView (attrValue);
return row;
}
示例3: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow header = new TableRow (Activity);
header.SetMinimumHeight (88);
TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
hParamsDrug.Gravity = GravityFlags.Center;
// hParamsDrug.Span = 2;
TextView hDrug = new TextView (Activity);
hDrug.Text = @"Препараты";
hDrug.LayoutParameters = hParamsDrug;
header.AddView(hDrug);
TableRow.LayoutParams p = new TableRow.LayoutParams ();
p.Height = TableLayout.LayoutParams.WrapContent;
p.Width = TableLayout.LayoutParams.WrapContent;
p.Gravity = GravityFlags.Center;
TableLayout tlHeader = new TableLayout (Activity);
TableRow rAttendance = new TableRow (Activity);
foreach (var attendace in currentAttendances) {
TextView hAttendace = new TextView (Activity);
hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
hAttendace.LayoutParameters = p;
hAttendace.Rotation = -70;
header.AddView (hAttendace);
// rAttendance.AddView(hAttendace);
}
// tlHeader.AddView (rAttendance);
// header.AddView (tlHeader);
// table.AddView(header);
foreach (var info in infos) {
TableRow r = new TableRow (Activity);
TextView v = new TextView (Activity);
v.Gravity = GravityFlags.Center;
v.SetSingleLine (false);
v.SetMinimumHeight (72);
v.SetMinimumWidth (68);
v.Rotation = -90;
// v.SetBackgroundResource (Resource.Style.text_row);
// v.SetB
// v.Text = info.infoID.ToString();
// v.Text = GetInfo(info.infoID).name;
// v.SetHorizontallyScrolling (false);
v.Text = info.name;
v.LayoutParameters = p;
r.AddView (v);
TableLayout tl = new TableLayout (Activity);
if (header.Parent == null) {
tl.AddView (header);
}
tl.Id = info.id;
foreach (var drug in drugs) {
TableRow rr = new TableRow (Activity);
rr.Id = drug.id;
TextView vv = new TextView (Activity);
vv.Gravity = GravityFlags.Center;
vv.SetMinimumHeight (42);
vv.SetMinimumWidth (76);
// vv.Text = drugInfo.drugID.ToString();
// vv.Text = GetDrug(drugInfo.drugID).fullName;
vv.Text = drug.fullName;
vv.LayoutParameters = p;
rr.AddView (vv);
foreach (var attendace in currentAttendances) {
RelativeLayout rl = new RelativeLayout(Activity);
rl.SetGravity (GravityFlags.Center);
rl.SetMinimumHeight (68);
rl.SetMinimumWidth (68);
rl.LayoutParameters = p;
rl.Id = attendace.id;
string value = string.Empty;
if (attendace.id != -1) {
value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
} else {
value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
rl.Click += Rl_Click;
}
TextView vvv = new TextView (Activity);
vvv.Gravity = GravityFlags.Center;
if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
// rl.SetBa
rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
// rl.SetBackgroundResource(Resource.Style.alert_success);
} else {
vvv.SetTextAppearance (Activity, Resource.Style.text_success);
//.........这里部分代码省略.........
示例4: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
user = Common.GetCurrentUser ();
merchant = Common.GetMerchant (user.username);
// currentRout = GetRout ();
// int[] ids = {1,2,3,4,5};
// currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (ids);
currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20);
infos = Common.GetInfos (user.username);
// infos = new List<Info>();
// infos.Add (new Info {id = 2, name = @"Кол-во" });
// infos.Add (new Info {id = 4, name = @"Розница" });
// infos.Add (new Info {id = 6, name = @"Заказано" });
drugs = Common.GetDrugs (user.username);
// AttendanceResultManager.DeleteAttendanceResult (1);
//// var att = new Attendance (1, new DateTime (2015, 10, 28), infos, drugs, @"N");
// var att = new Attendance() { id = 1, date = new DateTime (2015, 10, 28), pharmacy = 1 };
// AttendanceManager.SaveAttendance (att);
//
// var res = AttendanceResultManager.GenerateResults(infos, drugs, @"N");
// AttendanceResultManager.SaveNewAttendanceResults (att.id, res);
View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false);
text = rootView.FindViewById<TextView> (Resource.Id.largeText);
text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ";
text.SetTextAppearance (Activity, Resource.Style.text_danger);
table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent);
spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner);
ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies));
spnSelectedPharmacy.Adapter = adapter;
spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
selectedPharmacy = currentPharmacies [e.Position].id;
currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy);
RefreshTable();
};
spnSelectedPharmacy.SetSelection (0);
// RefreshTable ();
return rootView;
//return base.OnCreateView (inflater, container, savedInstanceState);
}
示例5: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false);
text = rootView.FindViewById<TextView> (Resource.Id.largeText);
user = Common.GetCurrentUser ();
if (user == null) {
text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ";
text.SetTextAppearance (Activity, Resource.Style.text_danger);
miAddAtt.SetEnabled (false);
return rootView;
}
merchant = Common.GetMerchant (user.username);
currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20);
infos = Common.GetInfos (user.username);
drugs = Common.GetDrugs (user.username);
table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent);
spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner);
ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies));
spnSelectedPharmacy.Adapter = adapter;
spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
selectedPharmacy = currentPharmacies [e.Position].id;
currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy);
RefreshTable();
};
spnSelectedPharmacy.SetSelection (0);
// RefreshTable ();
return rootView;
//return base.OnCreateView (inflater, container, savedInstanceState);
}
示例6: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
lpRow.Height = TableLayout.LayoutParams.WrapContent;
lpRow.Width = TableLayout.LayoutParams.WrapContent;
lpRow.Gravity = GravityFlags.Center;
//header
TableRow trHeader = new TableRow (Activity);
TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
//tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
tvHDrug.Text = "Препараты";
tvHDrug.LayoutParameters = lpRow;
((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
trHeader.AddView (tvHDrug);
int i = 0;
TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
lpValue.Height = TableLayout.LayoutParams.WrapContent;
lpValue.Width = TableLayout.LayoutParams.WrapContent;
lpValue.Gravity = GravityFlags.Center;
lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
foreach (var drug in drugs) {
i++;
TableRow trRow = new TableRow (Activity);
TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
tvDrug.Gravity = GravityFlags.CenterVertical;
tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
tvDrug.LayoutParameters = lpRow;
tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
trRow.AddView (tvDrug);
foreach (var info in infos) {
if (trHeader.Parent == null) {
TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
tvHInfo.Text = info.name;
tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
trHeader.AddView (tvHInfo);
}
RelativeLayout rlValue = new RelativeLayout(Activity);
rlValue.SetGravity (GravityFlags.Center);
rlValue.SetMinimumHeight (ToDIP(64));
rlValue.SetMinimumWidth (ToDIP(64));
rlValue.LayoutParameters = lpValue;
rlValue.SetTag (Resource.String.IDinfo, info.id);
rlValue.SetTag (Resource.String.IDdrug, drug.id);
// rlValue.SetTag (Resource.String.IDattendance, attendace.id);
string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
if (info.valueType == @"number") {
RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
nlpValue.AddRule (LayoutRules.CenterInParent);
nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
evValue.SetMinimumWidth (ToDIP(64));
evValue.SetMaxWidth (ToDIP(64));
evValue.InputType = Android.Text.InputTypes.ClassNumber;
evValue.Text = value.Equals (@"N") ? string.Empty : value;
rlValue.AddView (evValue);
evValue.AfterTextChanged += NumberValue_AfterTextChanged;
}
if (info.valueType == @"decimal") {
RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
dlpValue.AddRule (LayoutRules.CenterInParent);
dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
evValue.SetMinimumWidth (ToDIP(64));
evValue.SetMaxWidth (ToDIP(64));
evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
evValue.Text = value.Equals (@"N") ? string.Empty : value;
rlValue.AddView (evValue);
evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
}
if (info.valueType == @"boolean") {
rlValue.Click += Rl_Click;
TextView tvValue = new TextView (Activity);
tvValue.Gravity = GravityFlags.Center;
if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
} else {
tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
//.........这里部分代码省略.........
示例7: DisplayNeighborCount
void DisplayNeighborCount(LinearLayout tileLayout, int count)
{
Flip(tileLayout);
var text = new TextView(this);
text.SetTextAppearance(this, Resource.Style.CommonText);
text.Text = count.ToString();
tileLayout.AddView(text);
tileLayout.SetGravity(GravityFlags.Center);
}
示例8: CreateMealInfo
/// <summary>
/// Creates the meal info area in the programmitcally generated by Json.
/// </summary>
/// <returns>The meal info container for orginal Json calls.</returns>
/// <param name="json">Json from original call to be parsed.</param>
/// <param name="recipeResult">Recipe result (Json) using info from original Json.</param>
/// <param name="count">Count used for creating unique ids.</param>
private LinearLayout CreateMealInfo (JsonValue json,
JsonValue recipeResult, int count)
{
LinearLayout mealInfo = new LinearLayout (this);
mealInfo.Orientation = Orientation.Horizontal;
mealInfo.SetMinimumWidth (25);
mealInfo.SetMinimumHeight (25);
LinearLayout.LayoutParams mealInfoLL =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.WrapContent);
mealInfoLL.SetMargins (5, 5, 5, 5);
mealInfo.LayoutParameters = mealInfoLL;
mealInfo.Id = count * 20 + 7;
// Set image icon
ImageView dinerIcon = new ImageView (this);
dinerIcon.SetImageResource (Resource.Drawable.gray_person);
dinerIcon.LayoutParameters = new
LinearLayout.LayoutParams (50, LinearLayout.LayoutParams.MatchParent);
// Finish setting the image icon
TextView mealSize = new TextView (this);
TextView recipeInfo = new TextView (this);
recipeInfo.Text = handleRecipeJson (recipeResult);
recipeInfo.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
recipeInfo.SetLines (1);
LinearLayout.LayoutParams rill =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,
LinearLayout.LayoutParams.WrapContent);
recipeInfo.LayoutParameters = rill;
mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
LinearLayout.LayoutParams tvll =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,
LinearLayout.LayoutParams.WrapContent);
mealSize.LayoutParameters = tvll;
mealSize.Text = json ["Mealsize"].ToString ();
recipeInfo.SetPadding (10, 0, 0, 0);
mealSize.Gravity = GravityFlags.Right;
// Add image icon
mealInfo.AddView (mealSize);
mealInfo.AddView (dinerIcon);
mealInfo.AddView (recipeInfo);
return mealInfo;
}
示例9: RefreshTableContent2
private void RefreshTableContent2()
{
if (pfPharmacyTable != null) {
int childCount = pfPharmacyTable.ChildCount;
// Remove all rows except the first one
if (childCount > 1) {
pfPharmacyTable.RemoveViews(1, childCount - 1);
}
pharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (pfSearchEdit.Text, 20);
foreach (var pharmacy in pharmacies) {
string src = pfSearchEdit.Text;
string srcWithCap = UppercaseFirst(pfSearchEdit.Text);
string rpl = "";
TableRow row = new TableRow (Activity);
row.SetBackgroundResource(Resource.Drawable.bottomline);
//View view = layoutInflater.Inflate (Resource.Layout.LeftDrawerItem, null, false);//TextView id = new TextView (this.Activity);
TextView id = new TextView (Activity);
// id.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
// id.SetTextAppearance(Activity, Resource.Style.rowTextForPharmacy);
// id.SetPadding(24, 0, 24, 0);
// TableRow.LayoutParams p =
// p.RightMargin = 24;
// p.LeftMargin = 24;
id.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 24, LeftMargin = 24};
id.SetBackgroundResource(Resource.Drawable.bottomline);
id.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
id.SetHeight (48);
id.Gravity = GravityFlags.Center;
id.Text = pharmacy.id.ToString ();
row.AddView (id);
// CheckBox chk = new CheckBox (Activity);
// chk.SetPadding(24, 16, 24, 16);
// row.AddView (chk);
TextView fullName = new TextView (Activity);
// fullName.SetTextAppearance (Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
// fullName.SetPadding(0, 0, 56, 0);
// TableRow.LayoutParams fullNameP = new TableRow.LayoutParams();
// fullNameP.RightMargin = 56;
fullName.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 56};
// fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
// fullName.SetBackgroundResource(Resource.Drawable.bottomline);
fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
fullName.SetHeight (48);
fullName.Gravity = GravityFlags.CenterVertical;
if (string.IsNullOrEmpty (src)) {
fullName.Text = pharmacy.fullName;
} else {
rpl = pharmacy.fullName.Replace (src, @"<font color='red'>" + src + @"</font>");
rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
fullName.TextFormatted = Html.FromHtml (rpl);
}
row.AddView (fullName);
TextView shortName = new TextView (Activity);
// shortName.SetPadding(0, 0, 56, 0);0
// shortName.SetBackgroundResource(Resource.Drawable.bottomline);
shortName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
shortName.SetHeight (48);
shortName.Gravity = GravityFlags.CenterVertical;
if (string.IsNullOrEmpty (src)) {
shortName.Text = pharmacy.shortName;
} else {
rpl = pharmacy.shortName.Replace (src, @"<font color='red'>" + src + @"</font>");
rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
shortName.TextFormatted = Html.FromHtml (rpl);
}
row.AddView (shortName);
TextView officialName = new TextView (Activity);
// officialName.SetPadding(0, 0, 56, 0);
// officialName.SetBackgroundResource(Resource.Drawable.bottomline);
officialName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
officialName.SetHeight (48);
officialName.Gravity = GravityFlags.CenterVertical;
if (string.IsNullOrEmpty (src)) {
officialName.Text = pharmacy.officialName;
} else {
rpl = pharmacy.officialName.Replace (src, @"<font color='red'>" + src + @"</font>");
rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
officialName.TextFormatted = Html.FromHtml (rpl);
}
row.AddView (officialName);
TextView address = new TextView (Activity);
// address.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
// address.SetPadding(0, 0, 56, 0);
// address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
// address.SetBackgroundResource(Resource.Drawable.bottomline);
address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
address.SetHeight (48);
address.Gravity = GravityFlags.CenterVertical;
if (string.IsNullOrEmpty (src)) {
//.........这里部分代码省略.........
示例10: StationRenderer
public StationRenderer(Context context, GoogleMap map,
ClusterManager clusterManager) : base(context, map, clusterManager)
{
_context = context;
_map = map;
_clusterManager = clusterManager;
_contractService = SimpleIoc.Default.GetInstance<IContractService>();
_settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
_iconGenRed = new IconGenerator(_context);
_iconGenGreen = new IconGenerator(_context);
_iconGenOrange = new IconGenerator(_context);
_iconGenGrey = new IconGenerator(_context);
_iconGenGreyLowAlpha = new IconGenerator(_context);
//// Define the size you want from dimensions file
//var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null);
//iconGen.SetBackground(shapeDrawable);
////// Create a view container to set the size
_iconGenRed.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationRed, null));
_iconGenOrange.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationOrange, null));
_iconGenGreen.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreen, null));
_iconGenGrey.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGrey, null));
_iconGenGreyLowAlpha.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreyAlpha, null));
_iconRed = _iconGenRed.MakeIcon();
_iconGreen = _iconGenGreen.MakeIcon();
_iconOrange = _iconGenOrange.MakeIcon();
_iconGrey = _iconGenGrey.MakeIcon();
_iconGreyLowAlpha = _iconGenGreyLowAlpha.MakeIcon();
var textView = new TextView(context);
textView.SetTextAppearance(_context, Resource.Style.iconGenText);
_textPaint.AntiAlias = true;
_textPaint.SetARGB(255, 0, 0, 0);
_textPaint.TextSize = textView.TextSize;
_textPaint.TextAlign = Paint.Align.Center;
//_textPaint.SetTypeface(textView.Typeface);
_textPaint.SetTypeface(Typeface.CreateFromAsset(_context.Assets, "fonts/Roboto-Bold.ttf"));
}
示例11: GetItem
TextView GetItem(ColumnPosition columnPosition)
{
TextView textView = new TextView (Activity);
textView.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
textView.SetHeight (48);
// textView.
switch (columnPosition) {
case ColumnPosition.cpFirst:
textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 24, LeftMargin = 24 };
break;
case ColumnPosition.cpMiddle:
textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 56 };
break;
case ColumnPosition.cpLast:
textView.LayoutParameters = new TableRow.LayoutParams () { LeftMargin = 24 };
break;
default:
break;
}
return textView;
}
示例12: RefreshTable
//.........这里部分代码省略.........
v.SetMinimumHeight (72);
v.SetMinimumWidth (68);
v.Rotation = -90;
// v.SetBackgroundResource (Resource.Style.text_row);
// v.SetB
// v.Text = info.infoID.ToString();
// v.Text = GetInfo(info.infoID).name;
// v.SetHorizontallyScrolling (false);
v.Text = info.name;
v.LayoutParameters = p;
r.AddView (v);
TableLayout tl = new TableLayout (Activity);
if (header.Parent == null) {
tl.AddView (header);
}
tl.Id = info.id;
foreach (var drug in drugs) {
TableRow rr = new TableRow (Activity);
rr.Id = drug.id;
TextView vv = new TextView (Activity);
vv.Gravity = GravityFlags.Center;
vv.SetMinimumHeight (42);
vv.SetMinimumWidth (76);
// vv.Text = drugInfo.drugID.ToString();
// vv.Text = GetDrug(drugInfo.drugID).fullName;
vv.Text = drug.fullName;
vv.LayoutParameters = p;
rr.AddView (vv);
foreach (var attendace in drugInfo.attendaces) {
RelativeLayout rl = new RelativeLayout(Activity);
rl.SetGravity (GravityFlags.Center);
rl.SetMinimumHeight (68);
rl.SetMinimumWidth (68);
rl.LayoutParameters = p;
rl.Id = attendace.id;
rl.Click += (object sender, EventArgs e) => {
RelativeLayout rlAttendace = (RelativeLayout) sender;
TableRow trDrug = (TableRow) rl.Parent;
TableLayout trInfo = (TableLayout) rl.Parent.Parent;
string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);
Toast.MakeText(Activity, message, ToastLength.Short).Show();
FragmentTransaction trans = FragmentManager.BeginTransaction ();
DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
Bundle args = new Bundle();
args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
// args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));
drugInfoValueDialog.Arguments = args;
drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave;
drugInfoValueDialog.Show (trans, "dialog fragment");
Log.Info ("ifSignInButton", "Click");
};
// string value = GetDrugInfoValue (attendace.results, info.id, drug.id);
if (string.IsNullOrEmpty (value)) {
ImageView iv = new ImageView (Activity);
iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
// rl.SetBackgroundResource(Resource.Style.alert_success);
rl.AddView (iv);
} else {
TextView vvv = new TextView (Activity);
vvv.Gravity = GravityFlags.Center;
vvv.Text = value;
vvv.SetTextAppearance (Activity, Resource.Style.text_success);
// vvv.SetTextSize (ComplexUnitType.Sp, 24);
// vvv.SetTextColor(Android.Graphics.Color.Argb);
rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
rl.AddView (vvv);
}
rr.AddView (rl);
}
// for (int i = 0; i < 2; i++) { // Values
// ImageView iv = new ImageView (Activity);
// iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
// rr.AddView (iv);
// }
tl.AddView (rr);
}
r.AddView (tl);
table.AddView (r);
}
}
示例13: 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;
};
//.........这里部分代码省略.........
示例14: GetItem
TextView GetItem(ColumnPosition columnPosition)
{
TextView textView = new TextView (this);
textView.SetTextAppearance (this, Resource.Style.rowTextForPharmacy);
textView.SetHeight (ToDIP(48));
switch (columnPosition) {
case ColumnPosition.cpFirst:
textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24), LeftMargin = ToDIP(24) };
break;
case ColumnPosition.cpMiddle:
textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(56) };
break;
case ColumnPosition.cpLast:
textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24) };
break;
default:
break;
}
return textView;
}
示例15: handleMealSize
public void handleMealSize (TextView mealSize, LinearLayout.LayoutParams tvll, JsonValue json, String mealSizeString) {
mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
mealSize.LayoutParameters = tvll;
mealSize.Text = json [mealSizeString].ToString ();
mealSize.Gravity = GravityFlags.Right;
}