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


C# EditText.SetBackgroundDrawable方法代码示例

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


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

示例1: setItemLogin

		public void setItemLogin(){



			var txtFormat = Android.Util.ComplexUnitType.Px;

			linearButtonLogin = new LinearLayout (this);
			linearEditTextLogin = new LinearLayout (this);
			linearTextLogin = new LinearLayout (this);



			etxtUser = new EditText (this);
			etxtPassword = new EditText (this);
			btnLoginInto = new ImageButton (this);
			txtLogin_a = new TextView (this);
			txtLogin_b = new TextView (this);
			txtInicioSesion = new TextView (this);

			linearButtonLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearEditTextLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearTextLogin.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

			etxtUser.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtPassword.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));


			linearButtonLogin.Orientation = Orientation.Horizontal;
			linearButtonLogin.SetGravity (GravityFlags.Center);
			linearEditTextLogin.Orientation = Orientation.Vertical;
			linearEditTextLogin.SetGravity (GravityFlags.Center);
			linearTextLogin.Orientation = Orientation.Vertical;
			linearTextLogin.SetGravity (GravityFlags.Center);



			etxtUser.Hint = "  Usuario"; 
			etxtUser.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			etxtPassword.Hint = "  Contraseña";
			etxtPassword.InputType = Android.Text.InputTypes.TextVariationPassword | Android.Text.InputTypes.ClassText;
			etxtPassword.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;

			txtLogin_a.Text = "FORGOT PASSWORD?";
			txtLogin_a.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_b.Text = "            CHANGE";
			txtLogin_b.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_a.SetTextSize (txtFormat,Configuration.getHeight(30));
			txtLogin_b.SetTextSize (txtFormat, Configuration.getHeight (30));


			txtInicioSesion.Text = "Iniciar Sesión";
			txtInicioSesion.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			txtInicioSesion.SetTextColor (Color.ParseColor("#ffffff"));
			txtInicioSesion.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (36));

			btnLoginInto.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/otherlogin.png"),Configuration.getWidth (242), Configuration.getHeight (78),true));
			etxtUser.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtPassword.SetTextColor (Color.ParseColor ("#ffffff"));



			btnLoginInto.Click += delegate {
				_dialog.Show();
				var com = ((LoginViewModel)this.DataContext).LoginCommand;
				com.Execute(null);
				//AlertDialog.Builder popupBuilder = new AlertDialog.Builder(this);




			};

			initButtonColor (btnLoginInto);

			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;
			etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

			txtLogin_a.SetTextColor (Color.ParseColor ("#ffffff"));
			txtLogin_b.SetTextColor (Color.ParseColor ("#00c6ff"));


			Drawable drawableEditText = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cajatexto.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));
			etxtUser.SetBackgroundDrawable (drawableEditText);
			etxtPassword.SetBackgroundDrawable (drawableEditText);

			etxtUser.SetSingleLine (true);
			etxtPassword.SetSingleLine (true);

			LinearLayout space = new LinearLayout (this);
			space.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);


			linearTextLogin.AddView (txtLogin_a);

			linearTextLogin.AddView (txtLogin_b);

//.........这里部分代码省略.........
开发者ID:aocsa,项目名称:CInca,代码行数:101,代码来源:LoginView.cs

示例2: SetTheme

		public static void SetTheme(EditText editText, FlatTheme theme, 
			FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, FlatUI.FlatTextAppearance textAppearance,
			int style, int radius, int padding, int border)
		{
			float[] outerR = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

			// creating normal state drawable
			var normalFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));
			normalFront.SetPadding(padding, padding, padding, padding);

			var normalBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));
			normalBack.SetPadding(border, border, border, border);

			if (style == 0) {             // flat
				normalFront.Paint.Color = Color.Transparent;
				normalBack.Paint.Color = theme.LightAccentColor;
				editText.SetTextColor(theme.VeryLightAccentColor);

			} else if (style == 1) {      // box
				normalFront.Paint.Color = Color.White;
				normalBack.Paint.Color = theme.LightAccentColor;
				editText.SetTextColor(theme.BackgroundColor);

			} else if (style == 2) {      // transparent
				normalFront.Paint.Color = Color.Transparent;
				normalBack.Paint.Color = Color.Transparent;
				editText.SetTextColor(theme.BackgroundColor);
			}

			Drawable[] d = {normalBack, normalFront};
			LayerDrawable normal = new LayerDrawable(d);

			editText.SetBackgroundDrawable(normal);

			editText.SetHintTextColor(theme.VeryLightAccentColor);

			if (textAppearance == FlatUI.FlatTextAppearance.Dark) editText.SetTextColor(theme.DarkAccentColor);
			else if (textAppearance == FlatUI.FlatTextAppearance.Light) editText.SetTextColor(theme.VeryLightAccentColor);

			var typeface = FlatUI.GetFont(editText.Context, fontFamily, fontWeight);
			if (typeface != null)
				editText.SetTypeface(typeface, TypefaceStyle.Normal);
		}
开发者ID:kuruminbr,项目名称:FlatUI.Xamarin.Android,代码行数:43,代码来源:FlatEditText.cs

示例3: init

		public void init(){
			mainLayout = new RelativeLayout (this);
			txtRegister = new TextView (this);
			etxtEmail = new EditText (this);
			etxtUser = new EditText (this);
			etxtPassword = new EditText (this);
			btnCreateAccount = new ImageButton (this);
			linearButtonRegister = new LinearLayout (this);
			linearRegister = new LinearLayout (this);


			linearButtonRegister.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearRegister.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearButtonRegister.Orientation = Orientation.Horizontal;
			linearRegister.Orientation = Orientation.Vertical;
			linearButtonRegister.SetGravity (GravityFlags.Center);
			linearRegister.SetGravity (GravityFlags.Center);

			etxtUser.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtPassword.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtEmail.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
				
	


			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);
			Drawable drawableBackground = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cfondo.png"), 768, 1024, true));
			mainLayout.SetBackgroundDrawable (drawableBackground);


			txtRegister.Text = "Registro";
			txtRegister.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtUser.Hint ="  Nombre de usuario";
			etxtUser.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtEmail.Hint = "  Dirección de correo";
			etxtEmail.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtPassword.Hint ="  Contraseña";
			etxtPassword.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			Drawable drawableEditText = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cajatexto.png"), Configuration.getWidth (507), Configuration.getHeight (80), true));

			etxtUser.SetBackgroundDrawable (drawableEditText);
			etxtPassword.SetBackgroundDrawable (drawableEditText);
			etxtEmail.SetBackgroundDrawable (drawableEditText);

			etxtUser.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtUser.SetSingleLine (true);
			etxtPassword.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtPassword.SetSingleLine (true);
			etxtEmail.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtEmail.SetSingleLine (true);

			txtRegister.SetTextColor (Color.ParseColor("#ffffff"));
			txtRegister.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (40));

			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;
			etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

			btnCreateAccount.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/crearcuenta.png"), Configuration.getWidth (507), Configuration.getHeight (80), true));
			btnCreateAccount.Alpha = 255;
			//btn.SetAlpha(255);
			btnCreateAccount.SetBackgroundColor(Color.Transparent);


			LinearLayout space = new LinearLayout (this);
			space.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);
			LinearLayout space2 = new LinearLayout (this);
			space2.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);

			linearRegister.AddView (etxtUser);
			linearRegister.AddView (space);
			linearRegister.AddView (etxtEmail);
			linearRegister.AddView (space2);
			linearRegister.AddView (etxtPassword);

			linearButtonRegister.AddView (btnCreateAccount);

			txtRegister.SetX (Configuration.getWidth(72)); txtRegister.SetY (Configuration.getHeight(535));
			linearRegister.SetX (0); linearRegister.SetY (Configuration.getHeight(592));
			linearButtonRegister.SetX (0); linearButtonRegister.SetY (Configuration.getHeight(975));
			mainLayout.AddView (txtRegister);
			mainLayout.AddView (linearRegister);
			mainLayout.AddView (linearButtonRegister);

			//string ndef = "None" ;

			//string foto = "http://www.clinicatorielli.com/img/icons/no-user.png";

			EditText lastName = new EditText (this);
			lastName.Text = "None";

			EditText url = new EditText (this);
			url.Text = "http://www.clinicatorielli.com/img/icons/no-user.png";
//.........这里部分代码省略.........
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:101,代码来源:RegisterView.cs


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