本文整理汇总了C#中Android.Widget.TextView.SetSingleLine方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetSingleLine方法的具体用法?C# TextView.SetSingleLine怎么用?C# TextView.SetSingleLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetSingleLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestResultsGroupView
public TestResultsGroupView(Context context, TestRunInfo testRunInfo) : base(context)
{
var indicatorView = new View(context)
{
LayoutParameters = new LayoutParams(18, 18)
{
LeftMargin = 60,
RightMargin = 14,
TopMargin = 14,
BottomMargin = 14,
Gravity = GravityFlags.CenterVertical
}
};
indicatorView.SetBackgroundColor(
testRunInfo.IsIgnored ? Color.Yellow
: testRunInfo.Running ? Color.Gray
: testRunInfo.Passed ? Color.Green
: Color.Red);
AddView(indicatorView);
var container = new LinearLayout(context)
{
Orientation = Orientation.Vertical,
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
};
AddView(container);
var text1 = new TextView(context)
{
Text = testRunInfo.Description,
Ellipsize = TextUtils.TruncateAt.Marquee,
LayoutParameters =
new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
};
text1.SetTextSize(ComplexUnitType.Sp, 22);
text1.SetSingleLine(true);
text1.SetPadding(2, 2, 2, 2);
container.AddView(text1);
var text2 = new TextView(context)
{
Text = testRunInfo.TestCaseName,
Ellipsize = TextUtils.TruncateAt.Marquee,
LayoutParameters =
new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
};
text2.SetTextSize(ComplexUnitType.Sp, 14);
text2.SetSingleLine(true);
text2.SetPadding(2, 2, 2, 2);
container.AddView(text2);
}
示例2: BaseCellView
public BaseCellView(Context context, Cell cell) : base(context)
{
_cell = cell;
SetMinimumWidth((int)context.ToPixels(25));
SetMinimumHeight((int)context.ToPixels(25));
Orientation = Orientation.Horizontal;
var padding = (int)context.FromPixels(8);
SetPadding(padding, padding, padding, padding);
_imageView = new ImageView(context);
var imageParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
{
Width = (int)context.ToPixels(60),
Height = (int)context.ToPixels(60),
RightMargin = 0,
Gravity = GravityFlags.Center
};
using (imageParams)
AddView(_imageView, imageParams);
var textLayout = new LinearLayout(context) { Orientation = Orientation.Vertical };
_mainText = new TextView(context);
_mainText.SetSingleLine(true);
_mainText.Ellipsize = TextUtils.TruncateAt.End;
_mainText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_mainText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);
using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_mainText, lp);
_detailText = new TextView(context);
_detailText.SetSingleLine(true);
_detailText.Ellipsize = TextUtils.TruncateAt.End;
_detailText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_detailText.Visibility = ViewStates.Gone;
_detailText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);
using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_detailText, lp);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.Center };
using (layoutParams)
AddView(textLayout, layoutParams);
SetMinimumHeight((int)context.ToPixels(DefaultMinHeight));
_androidDefaultTextColor = Color.FromUint((uint)_mainText.CurrentTextColor);
}
示例3: CreateDefaultControl
//protected Visibility NativeComputedHorizontalScrollBarVisibility
//{
// get
// {
// return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
// }
// set
// {
// }
//}
//protected Visibility NativeComputedVerticalScrollBarVisibility
//{
// get
// {
// return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
// }
// set
// {
// }
//}
protected override View CreateDefaultControl(string value)
{
var innerDefaultControl = new NativeScrollViewer(this.Context);
innerDefaultControl.ScrollChanged += innerDefaultControl_ScrollChanged;
innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
if (this.Background != null)
innerDefaultControl.SetBackgroundDrawable(this.Background.ToDrawable());
var text = new Android.Widget.TextView(this.Context);
text.LayoutParameters = this.CreateLayoutParams();
text.Text = value;
text.SetSingleLine(true);
innerDefaultControl.ChildView = text;
this.ContentNativeUIElement = innerDefaultControl;
return innerDefaultControl;
}
示例4: 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);
}
}
示例5: ListItem
public ListItem( Context context ) : base( context )
{
Orientation = Android.Widget.Orientation.Vertical;
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.Orientation = Android.Widget.Orientation.Horizontal;
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
AddView( contentLayout );
Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Thumbnail.LayoutParameters = new LinearLayout.LayoutParams( (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ), (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ) );
( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
Thumbnail.SetScaleType( ImageView.ScaleType.CenterCrop );
contentLayout.AddView( Thumbnail );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.Orientation = Android.Widget.Orientation.Vertical;
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
TitleLayout.AddView( Title );
SubTitle = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
SubTitle.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
SubTitle.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
SubTitle.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
SubTitle.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
TitleLayout.AddView( SubTitle );
// fill the remaining space with a dummy view, and that will align our chevron to the right
View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 );
( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1;
contentLayout.AddView( dummyView );
Chevron = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Chevron.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)Chevron.LayoutParameters ).Gravity = GravityFlags.CenterVertical | GravityFlags.Right;
Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
Chevron.SetTypeface( fontFace, TypefaceStyle.Normal );
Chevron.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize );
Chevron.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon;
contentLayout.AddView( Chevron );
// add our own custom seperator at the bottom
Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
Seperator.LayoutParameters.Height = 2;
Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( Seperator );
}
示例6: 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);
//.........这里部分代码省略.........
示例7: Initialize
void Initialize ()
{
this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-2);// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
this.SetGravity(GravityFlags.CenterHorizontal);
imBack = new ImageView (context);
image = new LinearLayout(context);
txtDescription = new TextView (context);
txtTitle = new TextView (context);
background = new LinearLayout (context);
relTemp = new LinearLayout(context);
//LinearLayout.LayoutParams paramL = new new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), -2);
background.Orientation = Orientation.Vertical;
//background.SetBackgroundColor (Color.ParseColor ("#50000000"));
//background.BaselineAligned = true;
image.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
image.Orientation = Orientation.Vertical;
//image.SetGravity (GravityFlags.Center);
relTemp.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
//relTemp.SetGravity (GravityFlags.Center);
//RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(Configuration.getWidth (530), Configuration.getHeight (356));
//param.AddRule (LayoutRules.CenterInParent);
relTemp.AddView (background);
txtTitle.SetTextColor (Color.ParseColor("#424242"));
txtDescription.SetTextColor(Color.ParseColor("#424242"));
//txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
//txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
txtTitle.SetTextSize (ComplexUnitType.Dip, 21.0f);
txtDescription.SetTextSize (ComplexUnitType.Dip, 12.0f);
txtDescription.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
txtDescription.SetSingleLine (false);
//txtDescription.SetMaxLines (9);
//txtDescription.line
background.AddView (txtTitle);
background.AddView (txtDescription);
image.AddView (relTemp);
image.AddView (imBack);
this.AddView (image);
//this.AddView (background);
}
示例8: Initialize
void Initialize ()
{
this.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
this.Orientation = Orientation.Vertical;
linea_separador = new View (context);
linea_separador.LayoutParameters = new ViewGroup.LayoutParams (-1, 5);
linea_separador.SetBackgroundColor (Color.ParseColor ("#eeeeee"));
imgUser = new ImageView (context);
scrollImage = new HorizontalScrollView (context);
scrollImage.HorizontalScrollBarEnabled = false;
linearImage = new LinearLayout (context);
linearPanelScroll = new LinearLayout (context);
linearContainer = new LinearLayout (context);
linearAll = new LinearLayout (context);
txtAuthor = new TextView (context);
txtContainer = new TextView (context);
txtTitle = new TextView (context);
linearAll.LayoutParameters = new LinearLayout.LayoutParams (-1,-2);
linearImage.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(140),-2);
linearContainer.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(500),-2);
linearPanelScroll.LayoutParameters = new LinearLayout.LayoutParams (-2,-2);
scrollImage.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (500), -2);
linearAll.Orientation = Orientation.Horizontal;
linearImage.Orientation = Orientation.Vertical;
linearContainer.Orientation = Orientation.Vertical;
txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight(40));
txtAuthor.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
txtContainer.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (45));
txtAuthor.SetTextColor (Color.ParseColor("#3c3c3c"));
txtContainer.SetTextColor (Color.ParseColor("#3c3c3c"));
txtTitle.SetSingleLine (true);
txtAuthor.SetSingleLine (true);
txtContainer.SetSingleLine (false);
txtContainer.SetPadding (0, 0, 20, 0);
txtContainer.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");
txtAuthor.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");
scrollImage.AddView (linearPanelScroll);
linearAll.AddView (linearImage);
linearAll.AddView (linearContainer);
linearImage.AddView (imgUser);
linearContainer.AddView (txtTitle);
linearContainer.AddView (txtAuthor);
linearContainer.AddView (txtContainer);
linearContainer.AddView (scrollImage);
int space = Configuration.getHeight (50);
scrollImage.SetPadding (0, 0, 0, space);
this.AddView (linearAll);
this.AddView (linea_separador);
this.SetPadding (0, 0,0, space);
}
示例9: PrayerLayoutRender
public PrayerLayoutRender( RectangleF bounds, float prayerActionHeight, Rock.Client.PrayerRequest prayer )
{
PrayerActionHeight = prayerActionHeight;
// Create the core layout that stores the prayer
LinearLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
LinearLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
LinearLayout.Orientation = Orientation.Vertical;
// add the name
NameLayout = new BorderedRectView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
NameLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
NameLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
( (LinearLayout.LayoutParams)NameLayout.LayoutParameters ).Weight = 1;
LinearLayout.AddView( NameLayout );
Name = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Name.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)Name.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Name.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Name.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Name.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
Name.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
Name.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Name.SetTextSize( ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Name.SetMaxLines( 1 );
Name.SetSingleLine( );
Name.SetHorizontallyScrolling( true );
Name.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Name.Text = prayer.FirstName.ToUpper( );
NameLayout.AddView( Name );
// create the layout for managing the category / date
LinearLayout detailsLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
detailsLayout.Orientation = Orientation.Horizontal;
detailsLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
LinearLayout.AddView( detailsLayout );
// add the category layout
CategoryLayout = new BorderedRectView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
CategoryLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
CategoryLayout.BorderWidth = 1;
CategoryLayout.SetBorderColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
CategoryLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
( (LinearLayout.LayoutParams)CategoryLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
( (LinearLayout.LayoutParams)CategoryLayout.LayoutParameters ).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -1 );
( (LinearLayout.LayoutParams)CategoryLayout.LayoutParameters ).Weight = 1;
detailsLayout.AddView( CategoryLayout );
// category
Category = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Category.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)Category.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Category.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 9 );
((RelativeLayout.LayoutParams)Category.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 9 );
((RelativeLayout.LayoutParams)Category.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
Category.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
Category.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
Category.SetTextSize( ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Category.SetMaxLines( 1 );
Category.SetSingleLine( );
Category.SetHorizontallyScrolling( true );
Category.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Category.Text = prayer.CategoryId.HasValue ? RockGeneralData.Instance.Data.PrayerIdToCategory( prayer.CategoryId.Value ) : RockGeneralData.Instance.Data.PrayerCategories[ 0 ].Name;
CategoryLayout.AddView( Category );
// add the date layout
DateLayout = new BorderedRectView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
DateLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
DateLayout.BorderWidth = 1;
DateLayout.SetBorderColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
DateLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
( (LinearLayout.LayoutParams)DateLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -1 );
( (LinearLayout.LayoutParams)DateLayout.LayoutParameters ).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
( (LinearLayout.LayoutParams)DateLayout.LayoutParameters ).Weight = 1;
detailsLayout.AddView( DateLayout );
// date
Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Date.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)Date.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Date.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 13 );
((RelativeLayout.LayoutParams)Date.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
((RelativeLayout.LayoutParams)Date.LayoutParameters ).AddRule( LayoutRules.AlignParentRight );
Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
Date.SetTextSize( ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Date.Text = string.Format( "{0:MM/dd/yy}", prayer.EnteredDateTime );
DateLayout.AddView( Date );
// actual prayer
Prayer = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
//.........这里部分代码省略.........
示例10: Init
private void Init(){
this.Orientation = Orientation.Vertical;
this.SetBackgroundResource(Resource.Color.bg_color);
int iSpecializationSize = specInfos.SpecialistDetail.Specializations.Count;
for (int k = 0; k < iSpecializationSize; k++) {
var tvSpecialisation = new TextView (this.Context) {
Text = specInfos.SpecialistDetail.Specializations [k].ProfessionalOrTrade
};
tvSpecialisation.SetTextColor (Color.Black);
tvSpecialisation.SetTypeface (null, TypefaceStyle.Bold);
tvSpecialisation.SetPadding (padLeft, padTop, 0, 0);
this.AddView (tvSpecialisation);
var tvSpecialisationMajor = new TextView (this.Context) {
Text = specInfos.SpecialistDetail.Specializations [k].Name
};
tvSpecialisationMajor.SetTextColor (Color.Black);
tvSpecialisationMajor.SetTypeface (null, TypefaceStyle.Bold);
tvSpecialisationMajor.SetPadding (padLeft1, padTop, 0, 0);
this.AddView (tvSpecialisationMajor);
string sTextLicense = " No";
if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) {
sTextLicense = " Yes";
}
var tvLicence = new TextView (this.Context) {
Text = context.GetString (Resource.String.licence_title) + sTextLicense
};
tvLicence.SetTextColor (Color.Black);
tvLicence.SetPadding (padLeft2, padTop, 0, 0);
tvLicence.SetTypeface (null, TypefaceStyle.Bold);
this.AddView (tvLicence);
if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) {
var tvLicenceNumber = new TextView (this.Context) {
Text = "License Number: " + specInfos.SpecialistDetail.Specializations [k].LicenseNumber
};
tvLicenceNumber.SetTextColor (Color.Black);
tvLicenceNumber.SetPadding (padLeft2, padTop, 0, 0);
tvLicenceNumber.SetTypeface (null, TypefaceStyle.Bold);
tvLicenceNumber.SetSingleLine (true);
tvLicenceNumber.Ellipsize = global::Android.Text.TextUtils.TruncateAt.End;
this.AddView (tvLicenceNumber);
// ImageView img = new ImageView (context);
// if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate)
// img.SetImageResource (Resource.Drawable.ic_check);
// else
// img.SetImageResource (Resource.Drawable.ic_close_large);
//
// RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(32 ,32);
// param.TopMargin = 15;
// img.LayoutParameters = param;
// LinearLayout ll = new LinearLayout (context);
// ll.Orientation = Orientation.Horizontal;
// ll.SetVerticalGravity (GravityFlags.CenterVertical);
// ll.AddView (tvLicence);
// ll.AddView (img);
//
// this.AddView (ll);
var tvCountryPermittedTitle = new TextView (this.Context) {
Text = context.GetString (Resource.String.country_permitted)
};
tvCountryPermittedTitle.SetTextColor (Color.Black);
tvCountryPermittedTitle.SetPadding (padLeft2, padTop, 0, 0);
tvCountryPermittedTitle.SetTypeface (null, TypefaceStyle.Bold);
this.AddView (tvCountryPermittedTitle);
int size = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted.Count;
for (int n = 0; n < size; n++) {
var tvCountry = new TextView (this.Context) {
Text = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].Name
};
tvCountry.SetTextColor (Color.Black);
tvCountry.SetPadding (padLeft3, padTop, 0, 0);
tvCountry.SetTypeface (null, TypefaceStyle.Bold);
this.AddView (tvCountry);
int size1 = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories.Count;
for (int i = 0; i < size1; i++) {
var tvState = new TextView (this.Context) {
Text = "State: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].State
};
tvState.SetTextColor (Color.Black);
tvState.SetPadding (padLeft4, padTop1, 0, 0);
var tvRegulatory = new TextView (this.Context) {
Text = "Regulatory Authority: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].Regulatory
};
tvRegulatory.SetTextColor (Color.Black);
tvRegulatory.SetPadding (padLeft4, padTop1, 0, padTop2);
this.AddView (tvState);
this.AddView (tvRegulatory);
}
}
var tvProof = new TextView (this.Context) {
Text = context.GetString (Resource.String.proof_title)
//.........这里部分代码省略.........
示例11: MessageListItem
public MessageListItem( Context context ) : base( context )
{
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
Orientation = Orientation.Vertical;
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
contentLayout.Orientation = Orientation.Horizontal;
AddView( contentLayout );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent );
TitleLayout.Orientation = Orientation.Vertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Title );
Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
TitleLayout.AddView( Date );
Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
Speaker.SetMaxLines( 1 );
TitleLayout.AddView( Speaker );
// add our own custom seperator at the bottom
View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
seperator.LayoutParameters.Height = 2;
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( seperator );
// setup the buttons
LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1;
buttonLayout.Orientation = Orientation.Horizontal;
contentLayout.AddView( buttonLayout );
Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon;
ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
ListenButton.Background = null;
buttonLayout.AddView( ListenButton );
WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon;
WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
WatchButton.Background = null;
buttonLayout.AddView( WatchButton );
TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon;
TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
TakeNotesButton.Background = null;
buttonLayout.AddView( TakeNotesButton );
ListenButton.Click += (object sender, EventArgs e ) =>
{
//.........这里部分代码省略.........
示例12: GroupListItem
public GroupListItem( Context context ) : base( context )
{
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
Orientation = Orientation.Vertical;
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
contentLayout.Orientation = Orientation.Horizontal;
AddView( contentLayout );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
TitleLayout.Orientation = Orientation.Vertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Title );
Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
JoinButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
JoinButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Weight = 0;
( (LinearLayout.LayoutParams)JoinButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
JoinButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
JoinButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.GroupFinder_Join_IconSize );
JoinButton.Text = PrivateConnectConfig.GroupFinder_JoinIcon;
JoinButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
JoinButton.Background = null;
JoinButton.FocusableInTouchMode = false;
JoinButton.Focusable = false;
contentLayout.AddView( JoinButton );
JoinButton.Click += (object sender, EventArgs e ) =>
{
ParentAdapter.OnClick( Position, 1 );
};
MeetingTime = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
MeetingTime.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
MeetingTime.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
MeetingTime.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
MeetingTime.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( MeetingTime );
Distance = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Distance.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Distance.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
Distance.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Distance.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Distance );
// add our own custom seperator at the bottom
View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
seperator.LayoutParameters.Height = 2;
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( seperator );
}
示例13: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow header = new TableRow (Activity);
header.SetMinimumHeight (70);
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 drugInfo.attendaces) {
TextView hAttendace = new TextView (Activity);
hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
hAttendace.LayoutParameters = p;
hAttendace.Rotation = -60;
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 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;
//.........这里部分代码省略.........
示例14: 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;
};
//.........这里部分代码省略.........
示例15: CreateDefaultControl
protected virtual View CreateDefaultControl(string value)
{
var innerDefaultControl = new Android.Widget.TextView(this.Context);
innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
innerDefaultControl.SetSingleLine(true);
innerDefaultControl.Text = value;
return innerDefaultControl;
}