当前位置: 首页>>代码示例>>C#>>正文


C# TextView.SetText方法代码示例

本文整理汇总了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);
        }
开发者ID:rfcclub,项目名称:dot42,代码行数:7,代码来源:Simple.cs

示例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();
        }
开发者ID:GSDan,项目名称:Speeching_Client,代码行数:31,代码来源:VideoPlayerFragment.cs

示例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();
            }
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:30,代码来源:CheatActivity.cs

示例4: Initialize

 private void Initialize()
 {
     var text = new TextView(Context);
     text.SetHeight(500);
     text.SetWidth(200);
     text.SetText(Resource.String.FooWidgetText);
     AddView(text);
 }
开发者ID:alexyork-test,项目名称:Smeedee-Mobile,代码行数:8,代码来源:FooWidget.cs

示例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);
      }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:10,代码来源:LicenseActivity.cs

示例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());
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:54,代码来源:MainActivity.cs

示例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);
		}
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:11,代码来源:LogActivity.cs

示例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);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:12,代码来源:NewDocumentActivity.cs

示例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);
		}
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:52,代码来源:Main.cs

示例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;
            }
开发者ID:Xtremrules,项目名称:dot42,代码行数:13,代码来源:FragmentHideShowSupport.cs

示例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;
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:13,代码来源:FormattedSection.cs

示例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;
		}
开发者ID:alexrainman,项目名称:CarouselView,代码行数:16,代码来源:TextMeterImplementation.cs

示例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();
		}
开发者ID:okrotowa,项目名称:Mosigra.Yorsh,代码行数:17,代码来源:ChoosePlayerActivity.cs

示例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 ());
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:18,代码来源:TableLayout08.cs

示例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;
        }
开发者ID:PablusVinii,项目名称:SuperNWTBible,代码行数:18,代码来源:ChaptersActivity.cs


注:本文中的Android.Widget.TextView.SetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。