本文整理汇总了C#中Android.Widget.TextView.SetHeight方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetHeight方法的具体用法?C# TextView.SetHeight怎么用?C# TextView.SetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSampleContent
public override Android.Views.View GetSampleContent (Android.Content.Context context)
{
LinearLayout layout= new LinearLayout(context);
layout.Orientation = Orientation.Vertical;
TextView textView= new TextView(context);
textView.TextSize = 16;
textView.SetPadding(10,20,0,0);
textView.SetHeight(70);
textView.Text ="Top Population Countries With Bubbles";
layout.AddView(textView);
textView.Gravity = Android.Views.GravityFlags.Top;
maps = new SfMaps (context);
ShapeFileLayer layer = new ShapeFileLayer ();
layer.ShowItems = true;
layer.Uri ="world1.shp";
layer.DataSource = GetDataSource();
layer.ShapeIdPath = "Country";
layer.ShapeIdTableField = "NAME";
layer.ShapeSettings = new ShapeSetting ();
layer.ShapeSettings.ShapeValuePath= "ShortName";
layer.ShapeSettings.ShapeFill = Color.ParseColor ("#A9D9F7");
BubbleMarkerSetting marker = new BubbleMarkerSetting ()
{ FillColor = Color.ParseColor ("#ffa500"), MinSize=15,MaxSize=25, ValuePath="Population" };
layer.BubbleMarkerSetting = marker;
maps.Layers.Add (layer);
layout.AddView (maps);
return layout;
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var mLayout = new FrameLayout(this);
surface = UrhoSurface.CreateSurface(this, typeof(MySample));
//surface.Background.SetAlpha(10);
TextView txtView = new TextView(this);
txtView.SetBackgroundColor(Color.Violet);
txtView.SetWidth(10);
txtView.SetHeight(10);
txtView.Text = "HAHAH";
//txtView.Text = surface.Background.ToString();
Button btn = new Button(this);
btn.SetBackgroundColor(Color.Transparent);
btn.Text = "Button";
btn.SetHeight(100);
btn.SetWidth(100);
btn.SetX(30);
btn.SetY(30);
btn.TextAlignment = TextAlignment.Center;
mLayout.AddView(txtView);
mLayout.AddView(btn);
mLayout.AddView(surface);
SetContentView(mLayout);
}
示例3: Initialize
private void Initialize()
{
var text = new TextView(Context);
text.SetHeight(500);
text.SetWidth(200);
text.SetText(Resource.String.FooWidgetText);
AddView(text);
}
示例4: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
TextView button = new TextView(context);
button.SetText(chapters[position], TextView.BufferType.Normal);
button.TextSize = 32;
button.SetTypeface(ThisApp.Font(context, "ionbold"), Android.Graphics.TypefaceStyle.Normal);
button.SetHeight(84);
button.SetBackgroundResource(Resource.Drawable.metro_button_style);
button.Gravity = GravityFlags.Center;
//button.SetPadding(0, 0, 0, 0);
//button.SetTextColor(Resources.System.GetColorStateList(Resource.Color.metro_button_text_style));
//button.SetTextColor(Resources.System.GetColor(Resource.Color.metro_button_text_style));
button.Id = position;
button.Click += button_Click;
return button;
}
示例5: GetSampleContent
public override Android.Views.View GetSampleContent (Android.Content.Context context)
{
Toast currentToast=new Toast(context);
LinearLayout layout= new LinearLayout(context);
layout.Orientation = Orientation.Vertical;
TextView textView= new TextView(context);
textView.TextSize = 20;
textView.SetPadding(10,20,0,0);
textView.SetHeight(70);
textView.Text ="Primary Agricultural Data of USA";
layout.AddView(textView);
textView.Gravity = Android.Views.GravityFlags.Top;
maps = new SfMaps (context);
ShapeFileLayer layer = new ShapeFileLayer();
layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => {
JSONObject data = (JSONObject)e.P0;
if (data != null) {
if (currentToast != null) {
currentToast.Cancel ();
}
currentToast = Toast.MakeText (context, data.Get ("Name") + "\n" + data.Get ("Type"), ToastLength.Short);
currentToast.Show ();
}
};
layer.EnableSelection = true;
layer.Uri ="usa_state.shp";
layer.ShapeIdTableField ="STATE_NAME";
layer.ShapeIdPath ="Name";
layer.DataSource = GetDataSource ();
layer.ShapeSettings.ShapeStrokeThickess = 2;
SetColorMapping(layer.ShapeSettings);
layer.ShapeSettings.ShapeColorValuePath ="Type";
maps.Layers.Add (layer);
maps.SetY(-20);
layout.AddView (maps);
return layout;
}
示例6: createUI
private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false)
{
message.Reverse ();
contact.Reverse ();
int m = 0;
string messager = "";
bool dd = false;
if (message != null && contact != null) {
if (clear == false)
RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ());
string othername = string.Empty;
for (int i = 0; i < contact.Count; ++i) {
if (string.IsNullOrEmpty (nameTitle))
othername = contact [i].FirstName + " " + contact [i].LastName;
else
othername = nameTitle;
if (isMe != othername) {
RunOnUiThread (delegate {
Header.headertext = othername;
Header.fontsize = 36f;
ImageHelper.fontSizeInfo (header.Context);
header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
header.Text = Header.headertext;
});
break;
}
}
if (contact.Count > 1) {
string toReturn = "";
List<UserDB> sortedList = new List<UserDB> ();
sortedList = contact.OrderBy (s => s.LastName).OrderBy (s => s.FirstName).ToList ();
foreach (UserDB eachItem in sortedList)
toReturn += string.Format ("{0} {1}, ", eachItem.FirstName, eachItem.LastName);
int last = toReturn.LastIndexOf (", ");
toReturn = toReturn.Remove (last);
RunOnUiThread (delegate {
using (LinearLayout btnlayout = new LinearLayout (context)) {
btnlayout.Orientation = Android.Widget.Orientation.Vertical;
btnlayout.SetGravity (GravityFlags.Center);
btnlayout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
btnlayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
using (TextView name = new TextView(context)) {
name.Text = toReturn;
name.SetTextSize (Android.Util.ComplexUnitType.Dip, 18f);
name.SetTextColor (Color.Black);
btnlayout.AddView (name);
}
using (Button showAll = new Button (context)) {
showAll.Gravity = GravityFlags.CenterVertical;
showAll.Text = Application.Context.Resources.GetString (Resource.String.messageShowAllInConversation);
showAll.Click += (object sender, EventArgs e) => {
showParticipants (sender, e, contact); };
showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context));
showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context));
showAll.SetBackgroundResource (Resource.Drawable.button);
btnlayout.AddView (showAll);
}
listWrapper.AddView (btnlayout);
}
});
}
if (getGuid != null)
getGuid.Clear ();
RunOnUiThread (delegate {
foreach (MessageDB messages in message) {
string name = contact [m].FirstName + " " + contact [m].LastName;
ImageView random = null;
LinearLayout layout = new LinearLayout (context);
layout.Orientation = Android.Widget.Orientation.Horizontal;
layout.SetGravity (GravityFlags.CenterVertical);
layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
LinearLayout layout2 = new LinearLayout (context);
layout2.Orientation = Orientation.Vertical;
layout2.SetGravity (GravityFlags.Center);
if (name == isMe)
layout.AddView (contactUserInterface (messages, contact [m], true));
else
layout.AddView (contactUserInterface (messages, contact [m], false));
/*ImageView profilepic = new ImageView (context);
profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));
if (contact == null)
profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
else {
profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID);
profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
layout.AddView (profilepic);
if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage)
getGuid.Add (contact [m].AccountID);
else {
if (contact [m].Picture.Length > 0)
LoadUserImage (contact [m], profilepic);
//.........这里部分代码省略.........
示例7: CreatePreviewUI
//.........这里部分代码省略.........
name.Text = tmpName;
layout2.AddView (name);
}
if (eachMessage.Value.Message.MessageStepDBList.Count == 1 && eachMessage.Value.Message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
using (TextView txtMessage = new TextView (context)) {
using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context),
(int)ImageHelper.convertDpToPixel (60f, context))) {
txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0);
txtMessage.LayoutParameters = txtMessageParams;
}
txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context));
txtMessage.Gravity = GravityFlags.CenterVertical;
if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID)
txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright);
else
txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
txtMessage.TextSize = 16f;
for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) {
if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) {
messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText;
break;
}
}
if (string.IsNullOrEmpty (messager))
messager = "";
int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
txtMessage.SetHeight (nolines);
txtMessage.SetTextColor (Android.Graphics.Color.Black);
txtMessage.Text = messager;
txtMessage.ContentDescription = eachMessage.Key;
txtMessage.Click += ConversationItem_Clicked;
layout2.AddView (txtMessage);
}
} else {
int text = 0;
for (int tt = 0; tt < eachMessage.Value.Message.MessageStepDBList.Count; ++tt) {
if (eachMessage.Value.Message.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
text++;
}
LinearLayout layout3 = new LinearLayout (context);
LinearLayout.LayoutParams layout3params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
layout3params.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context));
layout3.LayoutParameters = layout3params;
layout3.Orientation = Orientation.Horizontal;
layout3.SetGravity (GravityFlags.Left);
layout3.ContentDescription = eachMessage.Key;
layout3.Click += ConversationLayItem_Clicked;
layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
layout3.SetVerticalGravity (GravityFlags.CenterVertical);
layout3.SetMinimumHeight (30);
layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
int end = eachMessage.Value.Message.MessageStepDBList.Count > 3 ? 3 : eachMessage.Value.Message.MessageStepDBList.Count;
for (int i = 0; i < end; ++i) {
switch (eachMessage.Value.Message.MessageStepDBList [i].StepType) {
case LOLMessageDelivery.MessageStep.StepTypes.Text:
if (text == 1) {
示例8: GetSampleContent
public override View GetSampleContent (Android.Content.Context con)
{
dlgAlert = new AlertDialog.Builder(con);
dlgAlert.SetTitle("Results");
dlgAlert.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) =>
{
});
dlgAlert.SetCancelable(true);
Title.Add ("Software");
Title.Add ("Banking");
Title.Add ("Media");
Title.Add ("Medical");
spinners = new Spinner(con);
spinners.DropDownWidth = 500;
spinners.SetBackgroundColor(Color.Gray);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
(con, Android.Resource.Layout.SimpleSpinnerItem, Experience);
dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
spinners.Adapter = dataAdapter;
Country.Add ("UAE");
Country.Add ("Uruguay");
Country.Add ("United States");
Country.Add ("United Kingdom");
Country.Add ("Ukraine");
Experience.Add ("1");
Experience.Add ("2");
autoComplete1 = new SfAutoComplete(con);
autoComplete2 = new SfAutoComplete(con);
text1s = new TextView(con);
text2s = new TextView(con);
text3s = new TextView(con);
text4s = new TextView(con);
text6s = new TextView(con);
text11 = new TextView(con);
text22 = new TextView(con);
text33 = new TextView(con);
text44 = new TextView(con);
text55 = new TextView(con);
text66 = new TextView(con);
text77 = new TextView(con);
text88 = new TextView(con);
buttons = new Button(con);
buttons.SetWidth(ActionBar.LayoutParams.MatchParent);
buttons.SetHeight(40);
buttons.Text = "Search";
buttons.SetTextColor(Color.White);
buttons.SetBackgroundColor(Color.Gray);
buttons.Click += (object sender, EventArgs e) => {
GetResult();
//dlgAlert.SetMessage(count + " Jobs Found");
dlgAlert.SetMessage (cc + " Jobs Found");
dlgAlert.Create ().Show ();
};
text11.SetHeight(10);
text22.SetHeight(30);
text33.SetHeight(10);
text44.SetHeight(30);
text55.SetHeight(10);
text66.SetHeight(30);
text77.SetHeight(10);
text88.SetHeight(30);
text1s.Text = "Job Search";
text1s.TextSize = 30;
text1s.Typeface = Typeface.DefaultBold;
text2s.Text = "Country";
text2s.TextSize = 16;
text3s.Text = "Job Field";
text3s.TextSize = 16;
text4s.Text = "Experience";
text4s.TextSize = 16;
text6s.SetHeight(40);
ArrayAdapter<String> adapters = new ArrayAdapter<String>(con,
Android.Resource.Layout.SimpleListItem1, new Countrylist().Country);
autoComplete1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
autoComplete1.SetAutoCompleteSource(adapters);
autoComplete1.SuggestionMode = SuggestionMode.StartsWith;
autoComplete1.MaximumDropDownHeight = 200;
autoComplete1.Watermark = "Enter a country name";
ArrayAdapter<String> adapters1 = new ArrayAdapter<String>(con,
Android.Resource.Layout.SimpleListItem1, Title);
autoComplete2.SetAutoCompleteSource(adapters1);
autoComplete2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
autoComplete2.SuggestionMode = SuggestionMode.Contains;
autoComplete2.MaximumDropDownHeight = 200;
autoComplete2.Watermark = "Starts with ’S’, ‘M’ or ‘B’";
ArrayAdapter<String> adapters2 = new ArrayAdapter<String>(con,
//.........这里部分代码省略.........
示例9: createUI
private void createUI(MessageDB message, UserDB contact)
{
#if DEBUG
System.Diagnostics.Debug.WriteLine ("AccoundID (MC) = {0}", AndroidData.CurrentUser.AccountID.ToString ());
#endif
int m = 0;
string messager = "";
if (message != null && contact != null) {
RunOnUiThread (delegate {
ImageView random = null;
LinearLayout layout = new LinearLayout (context);
layout.Orientation = Android.Widget.Orientation.Horizontal;
layout.SetGravity (GravityFlags.CenterVertical);
layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context));
ImageView profilepic = new ImageView (context);
profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (60f, context), (int)ImageHelper.convertDpToPixel (100f, context));
profilepic.Tag = new Java.Lang.String ("profilepic_" + m.ToString ());
if (contact == null)
profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
else {
if (contact.Picture.Length > 0) {
//profilepic.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromStream(new MemoryStream(eachContact.ContactUser.Picture), "Profile"));
loadProfilePicture (contact.AccountID);
} else {
profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
}
//layout.AddView(profilepic);
LinearLayout layout2 = new LinearLayout (context);
layout2.Orientation = Orientation.Vertical;
layout2.SetGravity (GravityFlags.Center);
TextView name = new TextView (context);
name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), (int)ImageHelper.convertDpToPixel (40f, context));
name.Gravity = GravityFlags.Center;
name.SetTextColor (Color.White);
name.TextSize = 16f;
name.Text = contact.FirstName + " " + contact.LastName;
layout2.AddView (name);
TextView text = new TextView (context);
text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (60f, context));
text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
text.Gravity = GravityFlags.CenterVertical;
if (name.Text == isMe)
text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
else
text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
text.TextSize = 16f;
for (int e = 0; e < message.MessageStepDBList.Count; ++e) {
if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) {
messager = message.MessageStepDBList [e].MessageText;
break;
}
}
if (string.IsNullOrEmpty (messager))
messager = "No text message found";
int nolines = messager.Length / 27;
text.SetHeight ((nolines + 1) * 20);
text.SetTextColor (Android.Graphics.Color.Black);
text.Text = messager;
layout2.Clickable = true;
layout2.AddView (text);
if (message.MessageStepDBList.Count > 1) {
LinearLayout layout3 = new LinearLayout (context);
layout3.Orientation = Orientation.Horizontal;
if (name.Text == isMe)
layout3.SetGravity (GravityFlags.Right);
else
layout3.SetGravity (GravityFlags.Left);
layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
layout3.SetVerticalGravity (GravityFlags.CenterVertical);
layout3.SetMinimumHeight (30);
layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
if (name.Text != isMe) {
random = new ImageView (context);
random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
random.SetBackgroundResource (Resource.Drawable.playblack);
//random.Click += delegate { PlayMessage(message); };
layout3.AddView (random);
}
for (int i = 1; i < message.MessageStepDBList.Count; ++i) {
switch (message.MessageStepDBList [i].StepType) {
case LOLMessageDelivery.MessageStep.StepTypes.Animation:
random = new ImageView (context);
random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
random.SetBackgroundResource (Resource.Drawable.drawicon);
layout3.AddView (random);
break;
//.........这里部分代码省略.........
示例10: GetSampleContent
public override Android.Views.View GetSampleContent (Android.Content.Context context)
{
Toast currentToast=new Toast(context);
LinearLayout layout= new LinearLayout(context);
layout.Orientation = Orientation.Vertical;
TextView textView= new TextView(context);
textView.TextSize = 20;
textView.SetPadding(10,20,0,0);
textView.SetHeight(70);
textView.Text ="Top Population Countries";
layout.AddView(textView);
textView.Gravity = Android.Views.GravityFlags.Top;
SfMaps maps = new SfMaps (context);
ShapeFileLayer layer = new ShapeFileLayer ();
layer.Uri= "world1.shp";
layer.MarkerSelected += (object sender, ShapeFileLayer.MarkerSelectedEventArgs e) => {
PopulationMarker marker= (PopulationMarker)e.P0;
if(marker!=null)
{
if(currentToast!=null)
{
currentToast.Cancel();
}
currentToast= Toast.MakeText(context,marker.Name +"\n"+ marker.Population,ToastLength.Short);
currentToast.Show();
}
};
PopulationMarker usa= new PopulationMarker(context);
usa.Latitude =38.8833;
usa.Longitude=-77.0167;
usa.Name= "United States";
usa.Population ="321,174,000";
layer.Markers.Add(usa);
PopulationMarker brazil= new PopulationMarker(context);
brazil.Latitude=-15.7833;
brazil.Longitude=-47.8667;
brazil.Name = "Brazil";
brazil.Population= "204,436,000";
layer.Markers.Add(brazil);
PopulationMarker india= new PopulationMarker(context);
india.Latitude=21.0000;
india.Longitude=78.0000;
india.Name= "India";
india.Population ="1,272,470,000";
layer.Markers.Add(india);
PopulationMarker china= new PopulationMarker(context);
china.Latitude=35.0000;
china.Longitude=103.0000;
china.Name = "China";
china.Population = "1,370,320,000";
layer.Markers.Add(china);
PopulationMarker indonesia= new PopulationMarker(context);
indonesia.Latitude=-6.1750;
indonesia.Longitude=106.8283;
indonesia.Name="Indonesia";
indonesia.Population="255,461,700";
layer.Markers.Add(indonesia);
maps.Layers.Add (layer);
layout.AddView (maps);
return layout;
}
示例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: 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;
}
示例13: messageTextBox
private TextView messageTextBox(TextView txtMessage, MessageDB message, int position, int leftOver)
{
if (position < message.MessageStepDBList.Count)
{
if (string.IsNullOrEmpty(message.MessageStepDBList [position].MessageText))
txtMessage.Text = "";
else
txtMessage.Text = message.MessageStepDBList [position].MessageText;
}
int nolines = (int)(ImageHelper.convertDpToPixel((txtMessage.Text.Length / 27f) * 12f, context));
txtMessage.SetHeight(nolines);
txtMessage.SetTextColor(Android.Graphics.Color.Black);
return txtMessage;
}
示例14: GetSampleContent
public override View GetSampleContent (Context con)
{
LinearLayout linearLayout = new LinearLayout(con);
linearLayout.SetPadding(20, 20, 20, 30);
linearLayout.SetBackgroundColor(Color.Rgb(236, 235, 242));
linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
linearLayout.Orientation = Android.Widget.Orientation.Vertical;
TextView textView3 = new TextView(con);
textView3.TextSize=20;
textView3.Text=" "+"Departure";
textView3.SetTextColor (Color.Black);
range = new SfRangeSlider(con);
range.Minimum= 0;
range.Maximum=12;
range.TickFrequency=2;
range.ShowValueLabel=showlabel;
range.StepFrequency=6;
range.DirectionReversed=false;
range.ValuePlacement=valueplacement;
range.RangeEnd=12;
range.RangeStart=0;
range.TickPlacement=tickplacement;
range.ShowRange=showlabel;
range.SnapsTo=snapsto;
range.Orientation=Com.Syncfusion.Sfrangeslider.Orientation.Horizontal;
range.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150);
LinearLayout depstack =new LinearLayout (con);
depstack.Orientation = Android.Widget.Orientation.Horizontal;
depstack.AddView (textView3);
TextView textView4 = new TextView(con);
textView4.TextSize=13;
textView4.Text=" "+"(in Hours)";
textView4.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent);
textView4.SetTextColor (Color.ParseColor("#939394"));
textView4.Gravity = GravityFlags.Center;
depstack.AddView (textView4);
TextView textView7 = new TextView(con);
textView7.SetHeight (50);
linearLayout.AddView (textView7);
linearLayout.AddView (depstack);
TextView textView10 = new TextView(con);
TextView textView12 = new TextView(con);
linearLayout.AddView (textView12);
linearLayout.AddView (textView10);
linearLayout.AddView(range);
textView10.TextSize=13;
val3 = "12";
val4 = Math.Round (range.RangeEnd).ToString ();
textView10.SetTextColor (Color.ParseColor ("#939394"));
textView10.Text = " "+"Time: "+val3 +"AM " +" - "+ val4 +" PM";
textView10.Gravity = GravityFlags.Left;
range.RangeChanged += (object sender, SfRangeSlider.RangeChangedEventArgs e) => {
String pmstr2="AM",pmstr1 = "AM";
if(Math.Round(e.P1).ToString() =="0" ) {
val3 = "12";
pmstr1 = "AM";
}
else
val3 = Convert.ToString(Math.Round(e.P1));
if (e.P2 <= 12)
val4 = Convert.ToString(Math.Round(e.P2));
if(Math.Round(e.P2).ToString()=="12")
pmstr2 = "PM";
if(Math.Round(e.P2).ToString()=="12")
pmstr2 = "PM";
if(Convert.ToString(Math.Round(e.P1)).Equals(Convert.ToString(Math.Round(e.P2)))){
if(Math.Round(e.P1).ToString() =="0" )
textView10.Text=" "+"Time: "+val3 +" "+ pmstr1;
else if(Math.Round(e.P2).ToString()=="12")
textView10.Text=" "+"Time: "+val4 +" "+ pmstr2;
else
textView10.Text=" "+"Time: "+val3 +" "+ pmstr1;
}
else
textView10.Text=" "+"Time: " +val3+" "+ pmstr1 + " - "+ val4+" " + pmstr2;
};
TextView textView6 = new TextView(con);
textView6.SetHeight (70);
linearLayout.AddView (textView6);
TextView textView2 = new TextView(con);
textView2.TextSize=20;
textView2.Text=" "+"Arrival";
//.........这里部分代码省略.........
示例15: GetPropertyWindowLayout
public override View GetPropertyWindowLayout (Android.Content.Context context)
{
int width = context.Resources.DisplayMetrics.WidthPixels / 2;
propertylayout = new LinearLayout (context);
propertylayout.Orientation = droid.Vertical;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams (
width * 2, 5);
layoutParams.SetMargins (0, 5, 0, 0);
TextView textView1 = new TextView (context);
textView1.Text = " " + "TICK PLACEMENT";
textView1.TextSize = 15;
textView1.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
textView1.SetTextColor (Color.White);
textView1.Gravity = GravityFlags.Left;
TextView textview2 = new TextView (context);
textview2.SetHeight (14);
propertylayout.AddView (textview2);
tickSpinner = new Spinner (context);
tickSpinner.SetPadding (0, 0, 0, 0);
propertylayout.AddView (textView1);
SeparatorView separate = new SeparatorView (context, width * 2);
separate.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5);
propertylayout.AddView (separate, layoutParams);
TextView textview8 = new TextView (context);
textview8.SetHeight (20);
propertylayout.AddView (textview8);
propertylayout.AddView (tickSpinner);
TextView textview3 = new TextView (context);
propertylayout.AddView (textview3);
List<String> list = new List<String> ();
list.Add ("BottomRight");
list.Add ("TopLeft");
list.Add ("Outside");
list.Add ("Inline");
list.Add ("None");
dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
tickSpinner.Adapter = dataAdapter;
tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
String selectedItem = dataAdapter.GetItem (e.Position);
if (selectedItem.Equals ("BottomRight")) {
tickplacement = TickPlacement.BottomRight;
} else if (selectedItem.Equals ("TopLeft")) {
tickplacement = TickPlacement.TopLeft;
} else if (selectedItem.Equals ("Inline")) {
tickplacement = TickPlacement.Inline;
} else if (selectedItem.Equals ("Outside")) {
tickplacement = TickPlacement.Outside;
} else if (selectedItem.Equals ("None")) {
tickplacement = TickPlacement.None;
}
};
TextView textView3 = new TextView (context);
textView3.Text = " " + "LABEL PLACEMENT";
textView3.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
textView3.Gravity = GravityFlags.Left;
textView3.TextSize = 15;
textView3.SetTextColor (Color.White);
List<String> labelList = new List<String> ();
labelList.Add ("BottomRight");
labelList.Add ("TopLeft");
labelSpinner = new Spinner (context);
labelSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
String selectedItem = dataAdapter.GetItem (e.Position);
if (selectedItem.Equals ("TopLeft")) {
valueplacement = ValuePlacement.TopLeft;
} else if (selectedItem.Equals ("BottomRight")) {
valueplacement = ValuePlacement.BottomRight;
}
};
labelAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, labelList);
labelAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
labelSpinner.Adapter = labelAdapter;
labelSpinner.SetPadding (0, 0, 0, 0);
//.........这里部分代码省略.........