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


C# View.SetBackgroundDrawable方法代码示例

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


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

示例1: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			base.OnViewCreated (view, savedInstanceState);
			view.SetBackgroundDrawable (AndroidExtensions.DefaultBackground);
			SetEmptyText ("You have no favorites yet");
			ListView.ItemClick += (sender, e) => stationShower (e.Id);
		}
开发者ID:adamgoodrich,项目名称:Moyeu,代码行数:7,代码来源:FavoriteFragment.cs

示例2: setBackground

	public static void setBackground(View view, Drawable background) {
        if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean)
        {
			SDK16.setBackground(view, background);
		} else {
			view.SetBackgroundDrawable(background);
		}
	}
开发者ID:skywolf888,项目名称:Android-PullToRefresh.Net,代码行数:8,代码来源:ViewCompat.cs

示例3: OnCreate

        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            mView = new View(this.Activity);

            GradientDrawable background = (GradientDrawable) Resources.GetDrawable(Resource.Drawable.rounded_rect);
            background.SetColor(mColour);

            mView.SetBackgroundDrawable(background);
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, Xamarin.ActionbarSherlockBinding.App.ActionBar.LayoutParams.FillParent, mWeight);
            lp.SetMargins(marginLeft, marginTop, marginRight, marginBottom);
            mView.LayoutParameters = lp;
        }
开发者ID:kbalint,项目名称:SherlockTest,代码行数:13,代码来源:RoundedColourFragment.cs

示例4: OnCreate

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

			// Create your application here
			SetContentView (Resource.Layout.MapViewLayout);

			assignmentMapViewLayout = FindViewById<LinearLayout> (Resource.Id.mapViewAssignmentLayout);
			assignmentMapViewLayout.Click += (sender, e) => {
				var intent = new Intent (this, typeof(SummaryActivity));
				var tabActivity = (AssignmentTabActivity)Parent;
				tabActivity.MapData = null;
				assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
				menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
				StartActivity (intent);
			};
	    
			mapView = FindViewById<MapView> (Resource.Id.googleMapsView);
			mapView.OnCreate (bundle);
			mapView.GetMapAsync (this);

			//View containing the active assignment
			var view = new View (this);
			LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
			view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
			assignmentMapViewLayout.AddView (view);
			view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
			view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
			number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
			job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
			name = view.FindViewById<TextView> (Resource.Id.assignmentName);
			phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
			address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
			buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
			timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
			activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
			spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
			timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
			timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
			phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
			mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);

			phoneButton.Click += (sender, e) => {
				Extensions.MakePhoneCall (this, phone.Text);
			};

			mapButton.Click += (sender, e) => {
				var intent = new Intent (this, typeof(SummaryActivity));
				var tabActivity = (AssignmentTabActivity)Parent;
				tabActivity.MapData = null;
				assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
				menuViewModel.MenuIndex = 0;
				StartActivity (intent);
			};

			assignmentViewModel.LoadTimerEntryAsync ().ContinueWith (_ => {
				RunOnUiThread (() => {
					timer.Checked = assignmentViewModel.Recording;
				});
			});

			timer.CheckedChange += (sender, e) => {
				if (e.IsChecked != assignmentViewModel.Recording) {
					if (assignmentViewModel.Recording)
						assignmentViewModel.PauseAsync ();
					else
						assignmentViewModel.RecordAsync ();
				}
			};

			activeSpinner.ItemSelected += (sender, e) => {

				if (assignment == null)
					return;
				
				var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
				if (selected != assignment.Status) {
					switch (selected) {
					case AssignmentStatus.Hold:
						assignment.Status = selected;
						assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => {
							RunOnUiThread (() => {
								SetAssignment (false);
								UpdateLocations ();
							});
						});
						break;
					case AssignmentStatus.Complete:
						var intent = new Intent (this, typeof(SummaryActivity));
						menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
						StartActivity (intent);
						break;
					default:
						break;
					}
				}
			};
		}
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:98,代码来源:MapViewActivity.cs

示例5: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			base.OnViewCreated (view, savedInstanceState);
			view.SetBackgroundDrawable (AndroidExtensions.DefaultBackground);
		}
开发者ID:adamgoodrich,项目名称:Moyeu,代码行数:5,代码来源:RentalFragment.cs

示例6: SetSeparator

	    /**
	     * Sets the resource ID of the separator drawable to use between adjacent screens.
	     */
	    public void SetSeparator(int resId) {
	        if (mSeparatorDrawable != null && resId == 0) {
	            // remove existing separators
	            mSeparatorDrawable = null;
	            int num = ChildCount;
	            for (int i = num - 2; i > 0; i -= 2) {
	                RemoveViewAt(i);
	            }
	            RequestLayout();
	        } else if (resId != 0) {
	            // add or update separators
	            if (mSeparatorDrawable == null) {
	                // add
	                int numsep = ChildCount;
	                int insertIndex = 1;
	                mSeparatorDrawable = Resources.GetDrawable(resId);
	                for (int i = 1; i < numsep; i++) {
	                    View v = new View(Context);
	                    v.SetBackgroundDrawable(mSeparatorDrawable);
	                    LayoutParams lp = new LayoutParams(LayoutParams.WrapContent,LayoutParams.FillParent);
	                    v.LayoutParameters = lp;
	                    AddView(v, insertIndex);
	                    insertIndex += 2;
	                }
	                RequestLayout();
	            } else {
	                // update
	                mSeparatorDrawable = Resources.GetDrawable(resId);
	                int num = ChildCount;
	                for (int i = num - 2; i > 0; i -= 2) {
	                    GetChildAt(i).SetBackgroundDrawable(mSeparatorDrawable);
	                }
	                RequestLayout();
	            }
	        }
	    }
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:39,代码来源:Workspace.cs

示例7: OnViewCreated

        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            view.SetBackgroundDrawable(AndroidExtensions.DefaultBackground);

            mapFragment?.GetMapAsync(this);



		
            // Setup info pane
            SetSvgImage(pane, Resource.Id.bikeImageView, Resource.Raw.bike);
            SetSvgImage(pane, Resource.Id.lockImageView, Resource.Raw.ic_lock);
            SetSvgImage(pane, Resource.Id.stationLock, Resource.Raw.station_lock);
            SetSvgImage(pane, Resource.Id.bikeNumberImg, Resource.Raw.bike_number);
            SetSvgImage(pane, Resource.Id.clockImg, Resource.Raw.clock);
            SetSvgImage(pane, Resource.Id.stationNotInstalled, Resource.Raw.not_installed);
            starOnDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_on);
            starOffDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_off);
            var starBtn = pane.FindViewById<ImageButton>(Resource.Id.StarButton);
            starBtn.Click += HandleStarButtonChecked;
            streetViewFragment?.GetStreetViewPanoramaAsync(this);
        }
开发者ID:SpiderMaster,项目名称:BikeNow,代码行数:24,代码来源:ProntoMapFragment.cs

示例8: OnCreate

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

            SetContentView (Resource.Layout.AssignmentsLayout);

            assignmentsListView = FindViewById<ListView> (Resource.Id.assignmentsListView);
            assignmentActiveLayout = FindViewById<LinearLayout> (Resource.Id.assignmentSelectedItem);
            assignmentActiveLayout.Click += (sender, e) => AssignmentSelected (-1);

            assignmentsListView.ItemClick += (sender, e) => AssignmentSelected (e.Position);

            //View containing the active assignment
            var view = new View (this);
            LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
            view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
            assignmentActiveLayout.AddView (view);
            view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
            view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
            number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
            job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
            name = view.FindViewById<TextView> (Resource.Id.assignmentName);
            phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
            address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
            buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
            timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
            activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
            spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
            timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
            timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
            phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
            mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);

            timer.CheckedChange += (sender, e) => {
                if (e.IsChecked != assignmentViewModel.Recording) {
                    if (assignmentViewModel.Recording)
                        assignmentViewModel.PauseAsync ();
                    else
                        assignmentViewModel.RecordAsync ();
                }
            };

            activeSpinner.ItemSelected += (sender, e) => {
                if (assignment != null) {
                    var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
                    if (selected != assignment.Status) {
                        switch (selected) {
                        case AssignmentStatus.Hold:
                            timer.Checked = false;
                            assignment.Status = selected;
                            assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => RunOnUiThread (ReloadAssignments));
                            break;
                        case AssignmentStatus.Complete:
                               				//go to confirmations, this is getting called multiple times.
                            var intent = new Intent (this, typeof(SummaryActivity));
                            assignmentViewModel.SelectedAssignment = assignment;
                            menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
                            StartActivity (intent);
                            break;
                        default:
                            break;
                        }
                    }
                }
            };

            mapButton.Click += (sender, e) => {
                var activity = (AssignmentTabActivity)Parent;
                var intent = new Intent (activity, typeof(SummaryActivity));
                menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
                assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
                activity.StartActivity (intent);
            };

            phoneButton.Click += (sender, e) => {
                Extensions.MakePhoneCall (this, phone.Text);
            };
        }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:78,代码来源:AssignmentsActivity.cs

示例9: SetBackgroundCompat

 public static void SetBackgroundCompat(View view, Drawable d)
 {
     if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean)
     {
         view.SetBackgroundDrawable(d);
     }
     else
     {
         view.Background = d;
     }
 }
开发者ID:devxiaruwei,项目名称:MaterialDialogs,代码行数:11,代码来源:DialogUtils.cs


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