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


C# View.InflateAndBindLocalImageViewByResource方法代码示例

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


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

示例1: SetupViews

		void SetupViews(View layout, Bundle savedInstanceState)
		{
			// inflate the content layout
			_ContentLayout = layout.FindViewById<LinearLayout>(Resource.Id.contentLayout);

			// inflate and set the profile image view
			var profilePhotoImageView = _ContentLayout.FindViewById<ImageViewAsync>(Resource.Id.profilePhotoImageView);

			if (profilePhotoImageView != null)
			{
				// use FFImageLoading library to load an android asset image into the imageview
				ImageService.LoadFileFromApplicationBundle(_Acquaintance.PhotoUrl).Transform(new CircleTransformation()).Into(profilePhotoImageView);

				// use FFImageLoading library to asynchonously load the image into the imageview
				// ImageService.LoadUrl(_Acquaintance.PhotoUrl).Transform(new CircleTransformation()).Into(profilePhotoImageView);
			}

			// infliate and set the name text view
			_ContentLayout.InflateAndBindTextView(Resource.Id.nameTextView, _Acquaintance.DisplayName);

			// inflate and set the company name text view
			_ContentLayout.InflateAndBindTextView(Resource.Id.companyTextView, _Acquaintance.Company);

			// inflate and set the job title text view
			_ContentLayout.InflateAndBindTextView(Resource.Id.jobTitleTextView, _Acquaintance.JobTitle);

			_ContentLayout.InflateAndBindTextView(Resource.Id.streetAddressTextView, _Acquaintance.Street);

			_ContentLayout.InflateAndBindTextView(Resource.Id.cityTextView, _Acquaintance.City);

			_ContentLayout.InflateAndBindTextView(Resource.Id.statePostalTextView, _Acquaintance.StatePostal);

			_ContentLayout.InflateAndBindTextView(Resource.Id.phoneTextView, _Acquaintance.Phone);

			_ContentLayout.InflateAndBindTextView(Resource.Id.emailTextView, _Acquaintance.Email);

			_GetDirectionsActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.getDirectionsActionImageView, Resource.Mipmap.directions);
			_GetDirectionsActionImageView.Visibility = ViewStates.Invisible;
			_GetDirectionsActionImageView.Click += async (sender, e) => {
				if (_GeocodedLocation != null)
					// we're using the External Maps plugin from James Montemagno here (included as a NuGet)
					await CrossExternalMaps.Current.NavigateTo(_Acquaintance.DisplayName, _GeocodedLocation.Latitude, _GeocodedLocation.Longitude, NavigationType.Driving);
			};

			var messageActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.messageActionImageView, Resource.Mipmap.message);
			messageActionImageView.Click += (sender, e) => {
				// we're using the Messaging plugin from Carel Lotz here (included as a NuGet)
				var smsTask = MessagingPlugin.SmsMessenger;
				if (smsTask.CanSendSms)
					smsTask.SendSms(_Acquaintance.Phone.SanitizePhoneNumber(), "");
			};

			var phoneActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.phoneActionImageView, Resource.Mipmap.phone);
			phoneActionImageView.Click += (sender, e) => {
				// we're using the Messaging plugin from Carel Lotz here (included as a NuGet)
				var phoneCallTask = MessagingPlugin.PhoneDialer;
				if (phoneCallTask.CanMakePhoneCall)
					phoneCallTask.MakePhoneCall(_Acquaintance.Phone.SanitizePhoneNumber());
			};

			var emailActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.emailActionImageView, Resource.Mipmap.email);
			emailActionImageView.Click += (sender, e) => {
				// we're using the Messaging plugin from Carel Lotz here (included as a NuGet)
				var emailTask = MessagingPlugin.EmailMessenger;
				if (emailTask.CanSendEmail)
					emailTask.SendEmail(_Acquaintance.Email, "");
			};

			// inflate the map view
			var mapview = FindViewById<MapView>(Resource.Id.map);

			// create the map view with the context
			mapview.OnCreate(savedInstanceState);

			// get the map, which calls the OnMapReady() method below (by virtue of the IOnMapReadyCallback interface that this class implements)
			mapview.GetMapAsync(this);
		}
开发者ID:RadaSangOn,项目名称:app-acquaint,代码行数:77,代码来源:AcquaintanceDetailActivity.cs


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