本文整理汇总了C#中Android.Widget.TextView.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetPadding方法的具体用法?C# TextView.SetPadding怎么用?C# TextView.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
//return base.OnCreateView (inflater, container, savedInstanceState);
linLayout = viewResource.LinLayout (this.Activity);
//linLayout.Id = 1;
txtViewTitle = viewResource.TextViewTitle (this.Activity);
txtViewTitle.SetPadding (10, 10, 10, 10);
button = viewResource.BtnOne (this.Activity);
button.Click += OnButtonClick;
button.Text = "Click me!";
buttonTwo = viewResource.BtnTwo (this.Activity);
txtViewTwo = viewResource.TextViewOne(this.Activity);
txtViewTwo.Text = "Click the button!";
subLayout = viewResource.SubLinLayout (this.Activity);
subLayout.AddView (txtViewTwo);
subLayout.AddView (button);
subLayout.AddView (buttonTwo);
linLayout.AddView (subLayout);
linLayout.SetBackgroundColor (Android.Graphics.Color.BlueViolet);
return linLayout;
}
示例2: GetView
// create a new ImageView for each item referenced by the Adapter
public override View GetView(int position, View convertView, ViewGroup parent)
{
//Button tagButton;
TextView tagButton;
if (convertView == null)
{ // if it's not recycled, initialize some attributes
//tagButton = new Button(context);
tagButton = new TextView(context);
//tagButton.LayoutParameters = new GridView.LayoutParams(190, 190);
tagButton.LayoutParameters = new GridView.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
tagButton.SetTextColor(Color.Rgb(34, 191, 185));
//tagButton.SetPadding(5, 2, 5, 2);// ltrb
tagButton.SetPadding(10, 4, 10, 4);// ltrb
tagButton.SetBackgroundResource(Resource.Drawable.flame_style);
//imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
}
else
{
//tagButton = (Button)convertView;
tagButton = (TextView)convertView;
}
// Bitmap bmp = MediaStore.Images.Thumbnails.GetThumbnail(cr, items[position].ImageId, ThumbnailKind.MicroKind, null);
//imageView.SetImageBitmap(bmp);
tagButton.Text = items[position].TagStr;
return tagButton;
}
示例3: 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;
}
示例4: OnCreateView
/// <summary>
/// Creates a new view for the profile fragment whenever a new username is selected
/// and displays the corresponding profile bios.
/// <param name="inflater">Android layout inflater.</param>
/// <param name="container">.ndroid view container</param>
/// <param name="savedInstanceState">Bundle.</param>
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (container == null)
{
// Currently in a layout without a container, so no reason to create our view.
return null;
}
var scroller = new ScrollView(Activity);
var text = new TextView(Activity);
var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics));
text.SetPadding(padding, padding, padding, padding);
text.TextSize = 24;
try {
text.Text = nearbyBios[ShownUserId];
}
catch(IndexOutOfRangeException e) {
string error = "\n\nServer offline\n\n" + e.Message;
System.Diagnostics.Debug.WriteLine (error);
nearbyBios = new string[1];
nearbyBios [0] = error;
}
scroller.AddView(text);
return scroller;
}
示例5: TextViewDialog
public static void TextViewDialog(Context context, string path, string text = null)
{
var textView = new TextView(context);
textView.SetPadding(10, 10, 10, 10);
textView.SetTextSize(ComplexUnitType.Sp, 10f);
var scrollView = new ScrollView(context);
scrollView.AddView(textView);
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.SetView(scrollView);
if (text == null) {
try {
using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("euc-kr"))) {
textView.Text = sr.ReadToEnd();
sr.Close();
}
} catch { }
} else {
textView.Text = text;
}
dialog.SetPositiveButton("닫기", delegate
{ });
dialog.Show();
}
示例6: Initialize
void Initialize ()
{
this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
this.SetGravity(GravityFlags.Center);
image = new RelativeLayout(context);
txtTitle = new TextView (context);
background = new LinearLayout (context);
linearTitle = new LinearLayout (context);
linearButton = new LinearLayout (context);
imgPlay = new ImageButton (context);
video = new VideoView (context);
image.SetGravity (GravityFlags.Bottom);
background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (111));
background.Orientation = Orientation.Horizontal;
background.SetBackgroundColor (Color.ParseColor ("#50000000"));
linearTitle.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (482), Configuration.getHeight (111));
linearTitle.Orientation = Orientation.Horizontal;
linearTitle.SetGravity (GravityFlags.Center);
linearButton.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (100), Configuration.getHeight (111));
linearButton.Orientation = Orientation.Horizontal;
linearButton.SetGravity (GravityFlags.Center);
image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
//image.SetGravity (GravityFlags.Bottom);
video.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(582),Configuration.getHeight(394));
imgPlay.Alpha = 255.0f;
imgPlay.SetBackgroundColor (Color.Transparent);
txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
txtTitle.SetPadding (Configuration.getWidth (20), 0, 0, 0);
txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
txtTitle.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
txtTitle.SetMaxLines (2);
//imgPlay.SetImageBitmap (Bitmap.CreateStxtcaledBitmap (getBitmapFromAsset ("icons/"), Configuration.getWidth (83), Configuration.getHeight (83), true));
linearTitle.AddView (txtTitle);
linearButton.AddView (imgPlay);
background.AddView (linearTitle);
background.AddView (linearButton);
image.AddView (background);
this.AddView (image);
//this.AddView (background);
}
示例7: RenderName
private View RenderName(Car car)
{
var textView = new TextView(Context);
textView.Text = car.Name;
textView.SetPadding(20, 10, 20, 10);
textView.TextSize = TextSize;
return textView;
}
示例8: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (container == null)
{
// Currently in a layout without a container, so no reason to create our view.
return null;
}
var scroller = new ScrollView(Activity);
var llayout = new LinearLayout (Activity);
llayout.Orientation = Orientation.Vertical;
var text = new TextView(Activity);
var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics));
text.SetPadding(padding, padding, padding, padding);
text.TextSize = 24;
var doc = DoctorManager.GetDoctor (ShownPlayId);
var hosp = HospitalManager.GetHospital (doc.HospitalID);
text.Text = "Фамилия: " + doc.FirstName + "\n\n" +
"Имя: " + doc.SecondName + "\n\n" +
"Отчество: " + doc.ThirdName + "\n\n" +
"Больница: " + hosp.Name + "\n\n" +
"Адрес: " + hosp.Adress;
//Shakespeare.Dialogue[ShownPlayId];
llayout.AddView(text);
Spinner spn = new Spinner (Activity);
var preses = Presentations.GetPresentations ();
List<String> presentsTitle = new List<String>();
for (int i = 0; i < preses.Count; i++) {
for (int j = 0; j < preses[i].parts.Count; j++) {
presentsTitle.Add (preses [i].name + "." + preses [i].parts [j].name);
}
}
spn.Adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, presentsTitle.ToArray());
llayout.AddView(spn);
Button btnSlide = new Button (Activity);
btnSlide.Text = "Начать показ!";
btnSlide.Click += (sender, e) => {
var slides = new Intent ( Activity, typeof(PresentationView));
int presentationID = 0;
int partID = spn.SelectedItemPosition;
for (int i=0; (i <= preses.Count-1) && (partID > preses[i].parts.Count-1); i++){
presentationID = i+1;
partID = partID - preses [i].parts.Count;
}
slides.PutExtra ("presentationID", presentationID);
slides.PutExtra ("partID", partID);
slides.PutExtra ("doctorID", ShownPlayId);
StartActivity (slides);
};
llayout.AddView (btnSlide);
scroller.AddView (llayout);
return scroller;
}
示例9: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
var textView = new TextView(_context);
textView.Text = _items.ElementAt(position).Label;
textView.SetPadding(5, 10, 0, 10);
return textView;
}
示例10: createColumn
private View createColumn(Context context, string ev)
{
TextView view = new TextView(context);
view.SetPadding(20, 0, 0, 0);
view.SetBackgroundColor(Android.Graphics.Color.White);
view.Text = ev;
view.SetTextColor(Android.Graphics.Color.ParseColor("#3B3477"));
return view;
}
示例11: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var rootLayout = new LinearLayout(this)
{
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent),
Orientation = Orientation.Vertical
};
var header = new TextView(this)
{
Text = "Log in",
TextSize = 30,
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent)
};
header.SetPadding(5, 11, 0, 11);
rootLayout.AddView(header);
var description = new TextView(this)
{
Text = "Log in the application with your account of choice.",
TextSize = 15,
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent)
};
description.SetPadding(5, 11, 5, 11);
rootLayout.AddView(description);
loginView = new AccessControlIdentityProviderListView(this)
{
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent),
Orientation = Orientation.Vertical
};
loginView.NavigateToIdentityProvider += loginView_NavigateToIdentityProvider;
var realm = Intent.GetStringExtra("monodroid.watoolkit.library.login.realm");
var acsNamespace = Intent.GetStringExtra("monodroid.watoolkit.library.login.acsNamespace");
loginView.Realm = realm;
loginView.ServiceNamespace = acsNamespace;
rootLayout.AddView(loginView);
SetContentView(rootLayout);
loginView.GetSecurityToken();
}
示例12: 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);
}
示例13: GetView
public override View GetView (int position, View convertView, ViewGroup parent)
{
TextView result = convertView as TextView;
if (result == null) {
result = new TextView (_activity) {
TextSize = 28.0f,
Text = _gestureActivities.Keys.ElementAt(position)
};
result.SetPadding (0, 15, 0, 15);
}
return result;
}
示例14: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu (IMenu menu)
{
tv = new TextView (this);
tv.Text = " Save ";
tv.TextSize = 20;
tv.SetPadding (0, 0, 20, 0);
tv.SetTextColor (Resources.GetColor(Resource.Color.mass_blue));
tv.Click += (sender, e) => {
saveClicked();
};
menu.Add (Resource.String.change_pin).SetActionView (tv).SetShowAsAction (ShowAsAction.Always);
return base.OnCreateOptionsMenu (menu);
}
示例15: GetSampleContent
public override View GetSampleContent (Context con)
{
LinearLayout linear = new LinearLayout(con);
linear.SetBackgroundColor(Color.White);
linear.Orientation = Orientation.Vertical;
linear.SetPadding(10, 10, 10, 10);
TextView text1 = new TextView(con);
text1.TextSize = 16;
text1.SetTextColor(Color.ParseColor("#262626"));
text1.Typeface = Typeface.DefaultBold;
text1.Text = "Allowed Characters";
text1.SetPadding(5, 10, 10, 5);
linear.AddView(text1);
TextView text2 = new TextView(con);
text2.TextSize = 14;
text2.SetTextColor(Color.ParseColor("#3F3F3F"));
text2.Text = "All 128 ASCII Characters";
text2.SetPadding(5, 5, 5, 5);
LinearLayout text2Layout = new LinearLayout(con);
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
text2Layout.LayoutParameters = parms;
text2Layout.AddView(text2);
linear.AddView(text2Layout);
LinearLayout barcodeLayout = new LinearLayout(con);
barcodeLayout.SetPadding(0, 10, 0, 5);
LinearLayout.LayoutParams parms1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
barcodeLayout.LayoutParameters = parms1;
barcode = new SfBarcode(con);
barcode.Text = "G71C0453";
Typeface fontFamily = Typeface.Create("helvetica", TypefaceStyle.Bold);
barcode.TextFont = fontFamily;
barcode.SetBackgroundColor(Color.ParseColor("#F2F2F2"));
barcode.Symbology = BarcodeSymbolType.Code39Extended;
barcode.TextSize = 20;
Code39ExtendedSettings setting = new Code39ExtendedSettings();
setting.BarHeight = 120;
setting.NarrowBarWidth = 3;
barcode.SymbologySettings = setting;
barcodeLayout.AddView(barcode);
linear.AddView(barcodeLayout);
return linear;
}