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


C# EditText.SetMaxLines方法代码示例

本文整理汇总了C#中EditText.SetMaxLines方法的典型用法代码示例。如果您正苦于以下问题:C# EditText.SetMaxLines方法的具体用法?C# EditText.SetMaxLines怎么用?C# EditText.SetMaxLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EditText的用法示例。


在下文中一共展示了EditText.SetMaxLines方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login

        public override void Login(LoginConfig config) {
            var context = Utils.GetActivityContext();
            var txtUser = new EditText(context) {
                Hint = config.LoginPlaceholder,
                Text = config.LoginValue ?? String.Empty
            };

            var txtPass = new EditText(context) {
                Hint = config.PasswordPlaceholder ?? "*",
                InputType = InputTypes.ClassText | InputTypes.TextVariationPassword,
                TransformationMethod = PasswordTransformationMethod.Instance
            };
            var layout = new LinearLayout(context) {
                Orientation = Orientation.Vertical
            };

			txtUser.SetMaxLines(1);
			txtPass.SetMaxLines(1);

            layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent);
            layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent);

            Utils.RequestMainThread(() => 
                new AlertDialog
                    .Builder(Utils.GetActivityContext())
                    .SetTitle(config.Title)
                    .SetCancelable(false)
                    .SetMessage(config.Message)
                    .SetView(layout)
                    .SetPositiveButton(config.OkText, (o, e) =>
                        config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true))
                    )
                    .SetNegativeButton(config.CancelText, (o, e) =>
                        config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false))
                    )
                    .Show()
            );
        }
开发者ID:Mvvmcross-Cn,项目名称:acrmvvmcross,代码行数:38,代码来源:DroidUserDialogService.cs

示例2: OnCreate

        /// <summary>
        /// Raises the create event.
        /// </summary>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

              // create an encrtyped preferences
              PortaPodderApp.prefs = new EncryptedPreferences();

              // create the layout
              layout = new LinearLayout(this);
              layout.Orientation = Orientation.Vertical;

              // create the username text label
              usernameText = new TextView(this);
              usernameText.Text = "Username";
              layout.AddView(usernameText);

              // create the edit box for the username
              usernameEdit = new EditText(this);
              usernameEdit.Gravity = GravityFlags.Center;
              usernameEdit.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextFlagNoSuggestions;
              usernameEdit.SetMaxLines(1);
              usernameEdit.Text = PortaPodderApp.prefs.GetString(EncryptedPreferences.KEY_USERNAME, string.Empty);
              layout.AddView(usernameEdit);

              // create the label for the password
              passwordText = new TextView(this);
              passwordText.Text = "Password";
              layout.AddView(passwordText);

              // create the edit box for the password
              passwordEdit = new EditText(this);
              passwordEdit.Gravity = GravityFlags.Center;
              passwordEdit.InputType = Android.Text.InputTypes.ClassText| Android.Text.InputTypes.TextFlagNoSuggestions | Android.Text.InputTypes.TextVariationPassword;
              usernameEdit.SetMaxLines(1);
              layout.AddView(passwordEdit);

              // we need to create a label to explain to people that this is only for linking into gpodder.net
              explainationText = new TextView(this);
              explainationText.Text = "PortaPodder is a client for the server gpodder.net and does not exist in a standalone environment.  You will need to visit gpodder.net and create an account in order to use this application.";
              layout.AddView(explainationText);

              // create a login button
              loginButton = new Button(this);
              loginButton.Text = "Login";
              loginButton.Click += loginButtonClicked;
              layout.AddView(loginButton);
              SetContentView(layout);
        }
开发者ID:brianbourke75,项目名称:PortaPodder,代码行数:52,代码来源:Authentication.cs

示例3: Login

        public override void Login(LoginConfig config)
        {
            var context = this.getTopActivity();
            var txtUser = new EditText(context) {
                Hint = config.LoginPlaceholder,
                InputType = InputTypes.TextVariationVisiblePassword,
                Text = config.LoginValue ?? String.Empty
            };
            var txtPass = new EditText(context) {
                Hint = config.PasswordPlaceholder ?? "*"
            };
            this.SetInputType(txtPass, InputType.Password);

            var layout = new LinearLayout(context) {
                Orientation = Orientation.Vertical
            };

            txtUser.SetMaxLines(1);
            txtPass.SetMaxLines(1);

            layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent);
            layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent);

            Utils.RequestMainThread(() => {
                var dialog = new AlertDialog
                    .Builder(this.getTopActivity())
                    .SetCancelable(false)
                    .SetTitle(config.Title)
                    .SetMessage(config.Message)
                    .SetView(layout)
                    .SetPositiveButton(config.OkText, (o, e) =>
                        config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true))
                    )
                    .SetNegativeButton(config.CancelText, (o, e) =>
                        config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false))
                    )
                    .Create();

                dialog.Window.SetSoftInputMode(SoftInput.StateVisible);
                dialog.Show();
            });
        }
开发者ID:RTodorov,项目名称:userdialogs,代码行数:42,代码来源:UserDialogsImpl.cs

示例4: Prompt

		public override void Prompt(PromptConfig config)
		{
			Utils.RequestMainThread(() =>
				{
					var activity = this.getTopActivity();
					var txt = new EditText(activity) {
						Hint = config.Placeholder
					};
					if (config.InputType != InputType.Default)
						txt.SetMaxLines(1);
					this.SetInputType(txt, config.InputType);
					var dialog = new AlertDialog
					.Builder(activity)
					.SetCancelable(false)
					.SetMessage(config.Message)
					.SetTitle(config.Title)
					.SetView(txt)
					.SetPositiveButton(config.OkText, (o, e) =>
						config.OnResult(new PromptResult {
								Ok = true,
								Text = txt.Text
							})
					             )
					.SetNegativeButton(config.CancelText, (o, e) =>
						config.OnResult(new PromptResult {
								Ok = false,
								Text = txt.Text
							})
					             ).Create();
					dialog.Window.SetSoftInputMode(SoftInput.StateVisible);
					dialog.Show();
				});
		}
开发者ID:Surfoo,项目名称:WF.Player,代码行数:33,代码来源:UserDialogService.cs

示例5: Prompt

        public override void Prompt(PromptConfig config) {
            Utils.RequestMainThread(() => {
                var txt = new EditText(Utils.GetActivityContext()) {
                    Hint = config.Placeholder
                };

                if (config.InputType != InputType.Default) 
					txt.SetMaxLines(1);

                SetInputType(txt, config.InputType);

                new AlertDialog
                    .Builder(Utils.GetActivityContext())
                    .SetMessage(config.Message)
                    .SetCancelable(false)
                    .SetTitle(config.Title)
                    .SetView(txt)
                    .SetPositiveButton(config.OkText, (o, e) =>
                        config.OnResult(new PromptResult {
                            Ok = true, 
                            Text = txt.Text
                        })
                    )
                    .SetNegativeButton(config.CancelText, (o, e) => 
                        config.OnResult(new PromptResult {
                            Ok = false, 
                            Text = txt.Text
                        })
                    )
                    .Show();
            });
        }
开发者ID:Mvvmcross-Cn,项目名称:acrmvvmcross,代码行数:32,代码来源:DroidUserDialogService.cs


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