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


C# RelativeLayout.SetGravity方法代码示例

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


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

示例1: 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);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);

			image.SetGravity (GravityFlags.Center);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
			background.Orientation = Orientation.Vertical;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtDescription.SetTextColor(Color.ParseColor("#ffffff"));
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));

			background.AddView (txtTitle);
			background.AddView (txtDescription);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
开发者ID:Milton761,项目名称:MLRepo,代码行数:35,代码来源:CustomerImageView.cs

示例2: 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);


		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:59,代码来源:CustomerVideoView.cs

示例3: RefreshTable

        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (88);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in currentAttendances) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -70;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in currentAttendances) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;

                        string value = string.Empty;
                        if (attendace.id != -1) {
                            value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
                        } else {
                            value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
                            rl.Click += Rl_Click;
                        }

                        TextView vvv = new TextView (Activity);
                        vvv.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
            //							rl.SetBa
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                        } else {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
//.........这里部分代码省略.........
开发者ID:pafik13,项目名称:pharm-merch-tablet,代码行数:101,代码来源:MainFragment+-+копия+(2).cs

示例4: iniPlancesList

		public void iniPlancesList()
		{
			//_currentPlaces.Clear ();
			_listLinearPlaces.Clear();
			placeSpace.RemoveAllViews ();
			placesContainer.RemoveAllViews ();

			VerticalScrollView listScrollPlaces = new VerticalScrollView (context);
			listScrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams (-1, Configuration.getHeight (345));
			listScrollPlaces.VerticalScrollBarEnabled = false;

			LinearLayout listSpaceLayout = new LinearLayout(context);
			listSpaceLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			listSpaceLayout.Orientation = Orientation.Vertical;

			for (int i = 0; i < _currentPlaces.Count; i++) {

				var item = _currentPlaces [i];

				LinearLayoutLO linearItem = new LinearLayoutLO (context);
				linearItem.index = i;
				TextView txtName = new TextView (context);
				ImageView imgIcon = new ImageView (context);

				txtName.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (420), -1);
				txtName.Gravity = GravityFlags.CenterVertical;

				txtName.Text = item.titulo;
				//txtName.SetTextColor (Color.ParseColor ("#ffffff"));
				txtName.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
				txtName.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
				//imgIcon.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset (item.Asset), Configuration.getWidth (30), Configuration.getWidth (30), true));

				int H = 80;
				int W = 120;

				linearItem.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (H));
				//linearItem.SetBackgroundDrawable (background_row);
				linearItem.Orientation = Orientation.Horizontal;
				linearItem.SetGravity (Android.Views.GravityFlags.CenterVertical);
				//linearItem.AddView (imgIcon);


				RelativeLayout imageLayout = new RelativeLayout (context);
				imageLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));
				ImageView iconImage = new ImageView (context);
				Picasso.With (context).Load (item.pathIcon).Resize(Configuration.getWidth(W),Configuration.getHeight(H)).CenterCrop().Into (iconImage);
				imageLayout.AddView (iconImage);

				LinearLayout gradiente = new LinearLayout (context);
				gradiente.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));

				imageLayout.AddView (gradiente);

				ImageIconMap icon = new ImageIconMap (context);
				icon.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (60), Configuration.getWidth (60));

				icon.index = 0;
				icon.SetImageBitmap(_leyendaIcon[item.tipoIndex]);
				//icon.SetPadding (Configuration.getWidth (20), ,0,0);
				icon.SetX(Configuration.getWidth (30));
				icon.SetY(Configuration.getHeight (10));

				RelativeLayout iconLayout = new RelativeLayout (context);
				iconLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));
				iconLayout.SetGravity (GravityFlags.Center);

				LinearLayout gradiente2 = new LinearLayout (context);
				gradiente2.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));

				iconLayout.AddView (icon);
				iconLayout.AddView (gradiente2);

				linearItem.AddView (imageLayout);
				linearItem.AddView (txtName);
				linearItem.AddView (iconLayout);
				int space = Configuration.getWidth (30);
				//linearItem.SetPadding (space,0,space,0);
				//imgIcon.SetPadding (Configuration.getWidth(68), 0, 0, 0);
				txtName.SetPadding (Configuration.getWidth(10), 0, 0, 0);

				if (i % 2 == 0) {
				gradiente.SetBackgroundResource (Resource.Drawable.gradiente2);
				gradiente2.SetBackgroundResource (Resource.Drawable.gradiente22);
				linearItem.SetBackgroundColor (Color.ParseColor ("#F0AE11"));
				txtName.SetTextColor (Color.White);
				} else {
				gradiente.SetBackgroundResource (Resource.Drawable.gradiente1);
				gradiente2.SetBackgroundResource (Resource.Drawable.gradiente11);
				txtName.SetTextColor (Color.ParseColor("#F0AE11"));
				}

				_listLinearPlaces.Add (linearItem);
				_listLinearPositonPlaces.Add (icon);
				listSpaceLayout.AddView (linearItem);

			}

			/*
			listPlaces = new ListView (context);
//.........这里部分代码省略.........
开发者ID:Milton761,项目名称:Hitec.Droid,代码行数:101,代码来源:MapView.cs

示例5: RefreshTable

        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
            lpRow.Height = TableLayout.LayoutParams.WrapContent;
            lpRow.Width = TableLayout.LayoutParams.WrapContent;
            lpRow.Gravity = GravityFlags.Center;

            //header
            TableRow trHeader = new TableRow (Activity);
            TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
            //tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
            tvHDrug.Text = "Препараты";
            tvHDrug.LayoutParameters = lpRow;
            ((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
            tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
            trHeader.AddView (tvHDrug);

            int i = 0;

            TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
            lpValue.Height = TableLayout.LayoutParams.WrapContent;
            lpValue.Width = TableLayout.LayoutParams.WrapContent;
            lpValue.Gravity = GravityFlags.Center;
            lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

            foreach (var drug in drugs) {

                i++;

                TableRow trRow = new TableRow (Activity);
                TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
                tvDrug.Gravity = GravityFlags.CenterVertical;
                tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
                tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
                tvDrug.LayoutParameters = lpRow;
                tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
                trRow.AddView (tvDrug);

                foreach (var info in infos) {

                    if (trHeader.Parent == null) {
                        TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
                        tvHInfo.Text = info.name;
                        tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
                        trHeader.AddView (tvHInfo);
                    }

                    RelativeLayout rlValue = new RelativeLayout(Activity);
                    rlValue.SetGravity (GravityFlags.Center);
                    rlValue.SetMinimumHeight (ToDIP(64));
                    rlValue.SetMinimumWidth (ToDIP(64));
                    rlValue.LayoutParameters = lpValue;

                    rlValue.SetTag (Resource.String.IDinfo, info.id);
                    rlValue.SetTag (Resource.String.IDdrug, drug.id);
            //					rlValue.SetTag (Resource.String.IDattendance, attendace.id);

                    string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);

                    if (info.valueType == @"number") {
                        RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        nlpValue.AddRule (LayoutRules.CenterInParent);
                        nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.ClassNumber;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += NumberValue_AfterTextChanged;
                    }

                    if (info.valueType == @"decimal") {
                        RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        dlpValue.AddRule (LayoutRules.CenterInParent);
                        dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
                    }

                    if (info.valueType == @"boolean") {
                        rlValue.Click += Rl_Click;

                        TextView tvValue = new TextView (Activity);
                        tvValue.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
                        } else {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
//.........这里部分代码省略.........
开发者ID:pafik13,项目名称:SBL-CRM,代码行数:101,代码来源:DrugInfoFragment.cs

示例6: ini

		public void ini(){

			Drawable dr = new BitmapDrawable (getBitmapFromAsset("images/1header.png"));
			header = new LinearLayout(context);
			header.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(125));
			header.Orientation = Orientation.Horizontal;
			header.SetGravity (GravityFlags.Center);
			header.SetBackgroundDrawable (dr);


			titulo_header = new TextView (context);
			titulo_header.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(550), -1);
			titulo_header.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
			titulo_header.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
			titulo_header.SetTextColor (Color.White);
			titulo_header.Gravity = GravityFlags.Center;
			//titulo_header.TextAlignment = TextAlignment.Center;

			placesInfoLayout = new LinearLayout (context);
			placesInfoLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			int space = Configuration.getWidth (30);
			placesInfoLayout.SetPadding(space,space,space,space);
			placesInfoLayout.Orientation = Orientation.Vertical;

			_mainLayout = new RelativeLayout (context);
			_mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			_mainLayout.AddView (header);

			mapImage = new ScaleImageView (context, null);
			mapImage.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			mapSpace = new LinearLayout (context);
			mapSpace.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(640), Configuration.getWidth(640));
			mapSpace.SetY (Configuration.getHeight (125));
			mapSpace.SetGravity (GravityFlags.Left);
			mapSpace.SetBackgroundColor (Color.ParseColor ("#DFC6BB"));
			//HUILLCA-----------------------------------------
			mapSpaceMarker = new RelativeLayout (context);
			mapSpaceMarker.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth(640), Configuration.getWidth(640));
			mapSpaceMarker.SetY (Configuration.getHeight (125));
			mapSpaceMarker.SetGravity (GravityFlags.Left);
			mapSpaceMarker.SetBackgroundColor (Color.Transparent);

			iconMarker = new ImageIconMap (context);
			iconMarker.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (60), Configuration.getWidth (60));
			int w = Configuration.getWidth (70);
			int h = Configuration.getWidth (70);
			iconMarker.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/iconmap12.png"), w, h, true));
			iconMarker.SetX (-100);
			iconMarker.SetY (-100);
			mapSpaceMarker.AddView (iconMarker);

			var fadeIn = new AlphaAnimation(0, 1);
			fadeIn.Interpolator = new AccelerateInterpolator();
			fadeIn.Duration = 1000;

			fadeOut = new AlphaAnimation(1, 0);
			fadeOut.Interpolator = new DecelerateInterpolator();
			fadeOut.Duration = 3000;
			fadeOut.AnimationEnd += (s, e) => 
			{
				 /*ThreadPool.QueueUserWorkItem(state =>
					{
						Thread.Sleep(2000); //wait 2 sec
						//RunOnUiThread(() => iconMarker.StartAnimation(fadeOut));
					});*/
					iconMarker.StartAnimation(fadeIn);
					iconMarker.Visibility = ViewStates.Invisible;
			};
			//-------------------------------------------------------
			mapSpace.AddView (mapImage);



			placeSpace = new VerticalScrollView (context);
			placeSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(375-85));
			placeSpace.SetY (Configuration.getHeight (125)+Configuration.getWidth(640));
			placeSpace.SetBackgroundColor (Color.White);

			placesContainer = new LinearLayout (context);
			placesContainer.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(375-85));
			placesContainer.Orientation = Orientation.Vertical;


			_mainLayout.AddView (mapSpace);
			_mainLayout.AddView (mapSpaceMarker);//HUILLCA
			_mainLayout.AddView (placeSpace);

			_publicidadLayout = new LinearLayout (context);
			_publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (85));
			Drawable drp = new BitmapDrawable (getBitmapFromAsset ("images/footerad.jpg"));
			_publicidadLayout.SetBackgroundDrawable (drp);
			_publicidadLayout.SetY (Configuration.getHeight(1136-85));
			_mainLayout.AddView (_publicidadLayout);
			_publicidadLayout.Click += delegate {
				if (adOpen) {


					hideAd ();
				} else {
//.........这里部分代码省略.........
开发者ID:Milton761,项目名称:Hitec.Droid,代码行数:101,代码来源:MapView.cs

示例7: initUnidades

		public void initUnidades(int indexCurso, int indexUnidad)
		{
			var textFormat = Android.Util.ComplexUnitType.Px;
			_spaceUnidades.RemoveAllViews ();
			_listLinearUnidades.Clear ();
			_listIconMap.Clear ();
			_listIconVerMap.Clear ();
			int numUnidades = _listUnidades.Count;
			for (int i = 0; i < numUnidades; i++) 
			{
				LinearLayoutLO linearUnidad = new LinearLayoutLO (context);
				linearUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearUnidad.Orientation = Orientation.Vertical;
				linearUnidad.SetGravity (Android.Views.GravityFlags.CenterVertical);
				linearUnidad.index = i;
				linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (25));
				//linearUnidad.SetX (100);

				if (indexCurso == 0) {//Para que solo afecte a las Rutas
					linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (-25));
				}

				TextView titleUnidad = new TextView(context);
				titleUnidad.SetTextSize (textFormat,Configuration.getHeight(42));
				titleUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);


				if (indexCurso == 2) {
					if (indexUnidad == 3) {
						linearUnidad.Orientation = Orientation.Horizontal;
						ImageIconMap icon = new ImageIconMap (context);
						icon.index = i;
						icon.SetImageBitmap(iconPlay);
						icon.SetX (Configuration.getWidth (60));
						linearUnidad.AddView (icon);
						_listIconMap.Add (icon);
					}
				}

				if (indexCurso == 3) {
					titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));
				}

				RelativeLayout linearContenido = new RelativeLayout (context);
				linearContenido.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenido.SetGravity (Android.Views.GravityFlags.Center);



				//TextView titleUnidad = new TextView(context);
				//titleUnidad.Text = _listUnidades [i].Title;
				titleUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Title);
				titleUnidad.SetTextColor(Color.ParseColor (Configuration.ListaColores [i % 6]));
				titleUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


				TextView descriptionUnidad = new TextView(context);
				descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);
				//descriptionUnidad.Text = _listUnidades [i].Description;

				descriptionUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Description);
				//descriptionUnidad.Text = _listUnidades [i].Description;
				descriptionUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
				descriptionUnidad.SetTextSize (textFormat,Configuration.getHeight(28));
				//Linkify.AddLinks (descriptionUnidad, MatchOptions.All);
				//Huillca
				if (indexCurso == 1   && indexUnidad!=6) {//Para que no afecte a las Rutas ni a los precios
					//Linkify.AddLinks(descriptionUnidad,Patterns.Phone,"tel:");
					//(084) 21-1122  --------modelo de telefono
					//984-820715 ----modelo celular
					Linkify.AddLinks(descriptionUnidad,Java.Util.Regex.Pattern.Compile("\\W\\d+\\W\\s\\d+\\W\\d+"),"tel:");
					Linkify.AddLinks(descriptionUnidad,Java.Util.Regex.Pattern.Compile("\\d+\\W\\d+"),"tel:");
					Linkify.AddLinks(descriptionUnidad,Patterns.EmailAddress,"email:");
					Linkify.AddLinks(descriptionUnidad,Patterns.WebUrl,"http://");
				}


				//descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
				//descriptionUnidad.LinksClickable = true;

				//descriptionUnidad.SetTextIsSelectable (true);

				LinearLayout linearContenidoIn = new LinearLayout (context);
				linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenidoIn.Orientation = Orientation.Vertical;
				//linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



				linearContenidoIn.AddView (titleUnidad);
				linearContenidoIn.AddView (descriptionUnidad);

				linearContenido.AddView (linearContenidoIn);

				if (indexCurso == 2) {
					linearContenidoIn.RemoveView (descriptionUnidad);
					ImageView imgUnidad = new ImageView (context);
					Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
					linearContenidoIn.AddView (imgUnidad);
					linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);
//.........这里部分代码省略.........
开发者ID:aocsa,项目名称:CInca,代码行数:101,代码来源:WallView.cs

示例8: initUnidades


//.........这里部分代码省略.........
				if (addTaskButton != null)
				{
					addTaskButton.Click += (sender, e) =>
					{
						//layoutSave.Visibility = Android.Views.ViewStates.Visible;
						context.StartActivity(typeof(NotasItemScreen));
					};
				}

				// wire up task click handler
				if (taskListView != null)
				{
					taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
					{
						var taskDetails = new Intent(context, typeof(NotasItemScreen));
						taskDetails.PutExtra("TaskID", tasks[e.Position].ID);
						context.StartActivity(taskDetails);
					};
				}
				return;
			}

			/*if (isFavoritos && numUnidades == 0)
			{
				Toast.MakeText(context, "Mis mejores Campamentos VACIOO", ToastLength.Short).Show();
			}*/

			for (int i = 0; i < numUnidades; i++) 
			{
				LinearLayoutLO linearUnidad = new LinearLayoutLO (context);
				linearUnidad.content = _listUnidades[i];
				linearUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearUnidad.Orientation = Orientation.Vertical;
				linearUnidad.SetGravity (Android.Views.GravityFlags.CenterVertical);
				//linearUnidad.SetBackgroundColor (Color.Blue);
				linearUnidad.index = i;
				linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (25));
				//linearUnidad.SetX (100);



				TextView titleUnidad = new TextView(context);
				titleUnidad.SetTextSize (textFormat,Configuration.getHeight(42));
				titleUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);


				/*if (indexCurso == 2) {
					if (indexUnidad == 3) {
						linearUnidad.Orientation = Orientation.Horizontal;
						ImageIconMap icon = new ImageIconMap (context);
						icon.index = i;
						icon.SetImageBitmap(iconPlay);
						icon.SetX (Configuration.getWidth (60));
						linearUnidad.AddView (icon);
						_listIconMap.Add (icon);
					}
				} */

				if (indexCurso == 3) {
					
					titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));

				}

				RelativeLayout linearContenido = new RelativeLayout (context);
				linearContenido.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
开发者ID:joselhuillca,项目名称:PeruCampinV2,代码行数:67,代码来源:WallView.cs

示例9: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            using (var ignore = new TV.Ouya.Sdk.OuyaInputView(this))
            {
                // do nothing
            }

            FrameLayout content = (FrameLayout)FindViewById(Android.Resource.Id.Content);
            if (null == content) {
                Log.Info(TAG, "Failed to get content");
                return;
            }

            RelativeLayout relativeLayout = new RelativeLayout (this);
            content.AddView (relativeLayout);
            FrameLayout.LayoutParams relativeLayoutParams = new FrameLayout.LayoutParams (FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            relativeLayout.LayoutParameters = relativeLayoutParams;
            relativeLayout.SetPadding(0, 0, 0, 0);

            LinearLayout verticalLayout = new LinearLayout (this);
            relativeLayout.AddView (verticalLayout);
            RelativeLayout.LayoutParams verticalLayoutParams = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            verticalLayout.LayoutParameters = verticalLayoutParams;
            verticalLayout.Orientation = Orientation.Vertical;
            verticalLayout.SetGravity (GravityFlags.Center);
            verticalLayout.SetPadding(0, 0, 0, 0);

            for (int y = 0; y < 2; ++y) {
                LinearLayout horizontalLayout = new LinearLayout (this);
                verticalLayout.AddView (horizontalLayout);
                LinearLayout.LayoutParams horizontalLayoutParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                horizontalLayout.LayoutParameters = horizontalLayoutParams;
                horizontalLayout.Orientation = Orientation.Horizontal;
                horizontalLayout.SetGravity (GravityFlags.Center);
                horizontalLayout.SetPadding(0, 0, 0, 0);

                int[] resources = {
                    Resource.Drawable.controller,
                    Resource.Drawable.a,
                    Resource.Drawable.dpad_down,
                    Resource.Drawable.dpad_left,
                    Resource.Drawable.dpad_right,
                    Resource.Drawable.dpad_up,
                    Resource.Drawable.lb,
                    Resource.Drawable.lt,
                    Resource.Drawable.l_stick,
                    Resource.Drawable.menu,
                    Resource.Drawable.o,
                    Resource.Drawable.rb,
                    Resource.Drawable.rt,
                    Resource.Drawable.r_stick,
                    Resource.Drawable.thumbl,
                    Resource.Drawable.thumbr,
                    Resource.Drawable.u,
                    Resource.Drawable.y,
                };

                for (int x = 0; x < 2; ++x) {
                    RelativeLayout controllerView = new RelativeLayout (this);
                    horizontalLayout.AddView (controllerView);
                    LinearLayout.LayoutParams controllerLayoutParams = new LinearLayout.LayoutParams (512, 512);
                    controllerView.LayoutParameters = controllerLayoutParams;
                    controllerView.SetGravity (GravityFlags.Center);
                    controllerView.SetPadding(100, 0, 0, 0);

                    Dictionary<int, ImageView> views = new Dictionary<int, ImageView> ();

                    foreach (int resourceId in resources) {

                        ImageView imageView = new ImageView (this);
                        controllerView.AddView (imageView);
                        imageView.SetImageResource (resourceId);
                        views [resourceId] = imageView;
                    }

                    VirtualControllerView controller = new VirtualControllerView (_controllers.Count,
                        views[Resource.Drawable.controller],
                        views[Resource.Drawable.a],
                        views[Resource.Drawable.dpad_down],
                        views[Resource.Drawable.dpad_left],
                        views[Resource.Drawable.dpad_right],
                        views[Resource.Drawable.dpad_up],
                        views[Resource.Drawable.lb],
                        views[Resource.Drawable.lt],
                        views[Resource.Drawable.l_stick],
                        views[Resource.Drawable.menu],
                        views[Resource.Drawable.o],
                        views[Resource.Drawable.rb],
                        views[Resource.Drawable.rt],
                        views[Resource.Drawable.r_stick],
                        views[Resource.Drawable.thumbl],
                        views[Resource.Drawable.thumbr],
                        views[Resource.Drawable.u],
                        views[Resource.Drawable.y]);

//.........这里部分代码省略.........
开发者ID:thoniorf,项目名称:ouya-sdk-examples,代码行数:101,代码来源:MainActivity.cs

示例10: RefreshTable

        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (70);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in drugInfo.attendaces) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -60;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in drugInfo.attendaces) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;
                        rl.Click += (object sender, EventArgs e) => {
                            RelativeLayout rlAttendace = (RelativeLayout) sender;
                            TableRow trDrug = (TableRow) rl.Parent;
                            TableLayout trInfo = (TableLayout) rl.Parent.Parent;

                            string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);

                            Toast.MakeText(Activity,  message, ToastLength.Short).Show();

                            FragmentTransaction trans = FragmentManager.BeginTransaction ();
                            DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
                            Bundle args = new Bundle();
                            args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
                            args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
                            args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
            //							args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));

                            drugInfoValueDialog.Arguments = args;
//.........这里部分代码省略.........
开发者ID:pafik13,项目名称:pharm-merch-tablet,代码行数:101,代码来源:MainFragment+-+копия.cs

示例11: Init

        private void Init()
        {
            base.RemoveAllViews();

            hintTextView = new EditText(Context);
            textTextView = new NoCursorMovingEditText(Context, BackKeyPressed);

            linearLayout = new LinearLayout(Context);
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight());

            textLayout = new RelativeLayout(Context);
            textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1);
            textLayout.SetGravity(GravityFlags.Center);

            linearLayout.AddView(textLayout);

            textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
            hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText);

            LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent,
                LinearLayout.LayoutParams.WrapContent);
            lp.AddRule(LayoutRules.CenterVertical);

            hintTextView.LayoutParameters = lp;
            textTextView.LayoutParameters = lp;
            hintTextView.Enabled = false;
            hintTextView.Focusable = false;

            textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
            hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;

            hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            int horizontalPadding =
                Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding);
            hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0);
            textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0);

            textErrorView = new EditText(Context);
            RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent,
                LayoutParams.WrapContent);
            errorLP.AddRule(LayoutRules.CenterVertical);

            int margin = UiUtils.ToPixels(Context, 2);
            errorLP.SetMargins(margin, 0, margin, 0);

            textErrorView.LayoutParameters = errorLP;
            textErrorView.Enabled = false;
            textErrorView.Focusable = false;
            textErrorView.Visibility = ViewStates.Gone;
            textErrorView.SetBackgroundColor(Color.Red);
            int errorVerticalPadding =
                Context.Resources.GetDimensionPixelOffset(
                    Resource.Dimension.backgroundhinttextview_error_vertical_padding);
            textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding);
            textErrorView.Text = errorText;
            textErrorView.SetSingleLine(true);
            textErrorView.Gravity = GravityFlags.Center;
            textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText);

            //set courier font
            Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
            //hintTextView.Typeface = type;
            hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            //textTextView.Typeface = type;
            textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            textErrorView.Typeface = type;


            textLayout.AddView(hintTextView);
            textLayout.AddView(textTextView);

            AddView(linearLayout);

            IEnumerable<char> previousCharSequence;
            EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) =>
                                                                    {
                                                                        previousCharSequence = args.Text;
                                                                    };

            EventHandler<TextChangedEventArgs> textChanged = (sender, args) =>
                                                            {
                                                                beforeTextSize = args.BeforeCount;
                                                            };

            EventHandler<AfterTextChangedEventArgs> afterTextChanged = null;

            
            Action<string> updateTextView = newText =>
            {
                textTextView.TextChanged -= textChanged;
                textTextView.BeforeTextChanged -= beforeTextChanged;
                textTextView.AfterTextChanged -= afterTextChanged;

                textTextView.Text = newText;

                textTextView.TextChanged += textChanged;
                textTextView.BeforeTextChanged += beforeTextChanged;
                textTextView.AfterTextChanged += afterTextChanged;
            };
//.........这里部分代码省略.........
开发者ID:TheJaniceTong,项目名称:Judo-Xamarin,代码行数:101,代码来源:BackgroundHintTextView.cs


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