本文整理汇总了C#中Android.Widget.TextView.SetText方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetText方法的具体用法?C# TextView.SetText怎么用?C# TextView.SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
var tv = new TextView(this);
tv.SetText("Hello Dot42");
SetContentView(tv);
}
示例2: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder dialog = new AlertDialog.Builder(Activity)
.SetTitle(title)
.SetPositiveButton("Got it", (sender, args) => { });
LayoutInflater inflater = Activity.LayoutInflater;
View view = inflater.Inflate(Resource.Layout.VideoHelpPopup, null);
video = view.FindViewById<VideoView>(Resource.Id.helper_video);
descriptionView = view.FindViewById<TextView>(Resource.Id.helper_explanation);
descriptionView.SetText(description.ToCharArray(),0, description.Length);
if (!string.IsNullOrEmpty(videoAdd))
{
video.Prepared += VideoPrepared;
video.SetVideoURI(Uri.Parse(videoAdd));
video.Touch += VideoTouched;
video.SetZOrderOnTop(true); // Removes dimming
}
else
{
LinearLayout holder = view.FindViewById<LinearLayout>(Resource.Id.helper_videoHolder);
holder.Visibility = ViewStates.Gone;
}
dialog.SetView(view);
return dialog.Create();
}
示例3: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_cheat);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) {
ActionBar.SetSubtitle(Resource.String.test_subject);
}
// Create your application here
mAnswerIsTrue = Intent.GetBooleanExtra(EXTRA_ANSWER_IS_TRUE, false);
mAnswerTextView = (TextView)FindViewById(Resource.Id.answerTextView);
mVersionTextView = (TextView)FindViewById(Resource.Id.apiVersion);
mVersionTextView.SetText(String.Format("API Level {0} {1}", Build.VERSION.Sdk, Build.VERSION.SdkInt.ToString()), TextView.BufferType.Normal);
// Answer will not be shown until the user presses the button
mWasAnswerShown = false;
SetAnswerShownResult(mWasAnswerShown);
mShowAnswer = (Button)FindViewById(Resource.Id.showAnswerButton);
mShowAnswer.Click += (object sender, EventArgs e) => {
ShowAnswer();
};
if (savedInstanceState != null) {
mWasAnswerShown = savedInstanceState.GetBoolean(KEY_ANSWER_SHOWN, false);
ShowAnswer();
}
}
示例4: Initialize
private void Initialize()
{
var text = new TextView(Context);
text.SetHeight(500);
text.SetWidth(200);
text.SetText(Resource.String.FooWidgetText);
AddView(text);
}
示例5: OnCreate
protected override void OnCreate(Android.Os.Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
ScrollView scroll = new ScrollView(this);
TextView license = new TextView(this);
license.SetText(GooglePlayServicesUtil.GetOpenSourceSoftwareLicenseInfo(this));
scroll.AddView(license);
SetContentView(scroll);
}
示例6: OnCreate
protected override void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
SetContentView(R.Layout.MainLayout);
var actionBar = GetActionBar();
actionBar.SetNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
//actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, R.Layout.TextView),
// this);
//actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item),
// this);
var adapter = ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item);
adapter.SetDropDownViewResource(Android.R.Layout.Simple_spinner_dropdown_item);
actionBar.SetListNavigationCallbacks(adapter, this);
tvAnswer = (TextView)FindViewById(R.Id.answer);
tvQuestion = (TextView)FindViewById(R.Id.question);
tvResult = (TextView)FindViewById(R.Id.result);
var btn = (Button)FindViewById(R.Id.cmd0);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd1);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd2);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd3);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd4);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd5);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd6);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd7);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd8);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.cmd9);
btn.Click += new EventHandler(btn_Click);
btn = (Button)FindViewById(R.Id.Ok);
btn.Click += new EventHandler(btnOk_Click);
btn = (Button)FindViewById(R.Id.Erase);
btn.Click += new EventHandler(btnErase_Click);
var gamePreferences = new Preferences();
gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", 0));
gameParameterFactory.Preferences = gamePreferences;
game = GameFactory.GetGame(gameType, gameParameterFactory);
tvQuestion.SetText(game.GetNextAssignment());
}
示例7: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.Log);
logView = FindViewById<TextView> (Resource.Id.log);
scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView);
scrollView.FullScroll(FocusSearchDirection.Down);
logView.SetText(savedText,TextView.BufferType.Editable);
scrollView.ScrollTo(0,logView.Height);
scrollView.FullScroll(FocusSearchDirection.Down);
}
示例8: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.activity_new_document);
documentCount = Intent.GetIntExtra (DocumentCentricActivity.KEY_EXTRA_NEW_DOCUMENT_COUNTER, 0);
documentCounterTextView = (TextView)FindViewById (Resource.Id.hello_new_document_text_view);
removeFromOverview = FindViewById<Button> (Resource.Id.remove_task_button);
removeFromOverview.Click+=delegate {
OnRemoveFromOverview();
};
documentCounterTextView.SetText (string.Format ("Hello Document {0}!", documentCount),TextView.BufferType.Normal);
}
示例9: OnCreate
protected override void OnCreate (Bundle bundle)
{
/*base.OnCreate (bundle);
SetContentView(Resource.Layout.CameraView);
camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview);
camera.Holder.SetType(SurfaceType.PushBuffers);
holder = camera.Holder;
Session.setSurfaceHolder(holder);*/
base.OnCreate (bundle);
base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
SetContentView (Resource.Layout.Main);
startButton = FindViewById<ImageButton> (Resource.Id.startButton);
connectButton = FindViewById<ImageButton> (Resource.Id.connectToClientButton);
settingsButton = FindViewById<ImageButton> (Resource.Id.settingsButton);
connectLight = FindViewById<ImageView> (Resource.Id.connectLight);
streamingLight = FindViewById<ImageView> (Resource.Id.streamingLight);
connectText = FindViewById<TextView> (Resource.Id.connectStatus);
streamText = FindViewById<TextView> (Resource.Id.streamingStatus);
logView = FindViewById<TextView> (Resource.Id.log);
scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView);
scrollView.FullScroll(FocusSearchDirection.Down);
logView.SetText(savedText,TextView.BufferType.Editable);
scrollView.ScrollTo(0,logView.Height);
scrollView.FullScroll(FocusSearchDirection.Down);
camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview);
camera.Holder.SetType(SurfaceType.PushBuffers);
//holder = camera.Holder;
Session.SetSurfaceHolder(camera.Holder);
startButton.Click += OnStartClicked;
connectButton.Click += OnConnectToClientClicked;
settingsButton.Click += OnStettingsClicked;
//this should be set based on something
DisableButton(connectButton);
EnableButton(settingsButton);
SetStartICon();
SetDisableLight(connectLight);
SetDisableLight(streamingLight);
connectText.Text = "Client is not connected";
streamText.Text = "Not streaming";
PreferenceManager.SetDefaultValues(this, Resource.Layout.Settings,false);
}
示例10: OnCreateView
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = Inflater.Inflate(R.Layout.labeled_text_edit, container, false);
View tv = v.FindViewById(R.Id.msg);
((TextView)tv).SetText("The fragment saves and restores this text.");
// Retrieve the text editor, and restore the last saved state if needed.
mTextView = (TextView)v.FindViewById(R.Id.saved);
if (savedInstanceState != null) {
mTextView.SetText(savedInstanceState.GetCharSequence("text"));
}
return v;
}
示例11: GetView
public override View GetView (Context context, View convertView, ViewGroup parent)
{
TextView tv = new TextView (context);
tv.TextSize = 20f;
tv.SetText (Android.Text.Html.FromHtml (Caption), TextView.BufferType.Spannable);
var parms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
parms.AddRule (LayoutRules.CenterHorizontal);
RelativeLayout view = new RelativeLayout (context, null, Android.Resource.Attribute.ListSeparatorTextViewStyle);
view.AddView (tv, parms);
return view;
}
示例12: MeasureTextSize
public double MeasureTextSize(string text, double width, double fontSize, string fontName = null)
{
var textView = new TextView(global::Android.App.Application.Context);
textView.Typeface = GetTypeface(fontName);
textView.SetText(text, TextView.BufferType.Normal);
textView.SetTextSize(ComplexUnitType.Px, (float)fontSize);
int widthMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec(
(int)width, AViews.MeasureSpecMode.AtMost);
int heightMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec(
0, AViews.MeasureSpecMode.Unspecified);
textView.Measure(widthMeasureSpec, heightMeasureSpec);
return (double)textView.MeasuredHeight;
}
示例13: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.ChoosePlayer);
SetHomeButtonEnabled (false);
var list = this.FindViewById<ListView>(Resource.Id.playerList);
_adapter = new PlayerListAdapter(this);
list.Adapter = _adapter;
_readyButton = (TextView)CreateActionButton(Resource.Drawable.table_button);
SetTextButtonEnabled (false);
_readyButton.SetText (Resource.String.ConfirmString);
_readyButton.SetTextColor (Resources.GetColorStateList(Resource.Drawable.ready_label_enable));
RegisterSubscribes();
}
示例14: AppendRow
void AppendRow (TableLayout table)
{
TableRow row = new TableRow (this);
TextView label = new TextView (this);
label.SetText (Resource.String.table_layout_8_quit);
label.SetPadding (3, 3, 3, 3);
TextView shortcut = new TextView (this);
shortcut.SetText (Resource.String.table_layout_8_ctrlq);
shortcut.SetPadding (3, 3, 3, 3);
shortcut.Gravity = GravityFlags.Right | GravityFlags.Top;
row.AddView (label, new TableRow.LayoutParams (1));
row.AddView (shortcut, new TableRow.LayoutParams ());
table.AddView (row, new TableLayout.LayoutParams ());
}
示例15: 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;
}