• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Views.View类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



View类属于Android.Views命名空间,在下文中一共展示了View类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnTouch

        // Check touch position on button
        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action)
            {
                // Get the x and y position for a touch (always before move)
                case MotionEventActions.Down:
                    old_x = e.GetX ();
                    old_y = e.GetY ();
                    Console.WriteLine ("x = " + old_x + " y = " + old_y);
                    break;
                // Get the x and y position difference continously
                case MotionEventActions.Move:
                    // Get the difference between current position and old position
                    new_x = e.GetX () - old_x;
                    new_y = e.GetY () - old_y;
                    // Convert to int, to remove decimal numbers (apparently can't be send through the tcp listener)
                    int_x = Convert.ToInt32 (new_x);
                    int_y = Convert.ToInt32 (new_y);
                    // Convert to string, so it can be send
                    send_x = Convert.ToString (int_x);
                    send_y = Convert.ToString (int_y);

                    // Send x and y position over two messages
                    Connect (ipAddress, send_x);
                    Connect (ipAddress, send_y);

                    // Set old position to current position
                    old_x = e.GetX ();
                    old_y = e.GetY ();
                    break;
            }
            return true;
        }
开发者ID:Blahfargl,项目名称:Glubenheim,代码行数:34,代码来源:MainActivity.cs


示例2: OnCreate

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

            SetContentView(Resource.Layout.Main);

            _view = FindViewById<LinearLayout>(Resource.Id.parentLayout);
            _text = FindViewById<TextView>(Resource.Id.logTextView);

            UpdateDisplay(INITIAL_MESSAGE,Color.White);

            var beaconManager = new BeaconManager(this);

            indoorLocationController = new IndoorLocationController(beaconManager);
            indoorLocationController.BeaconFound += HandleBeaconFound;
            indoorLocationController.BeaconLost += HandleBeaconLost;

            var beacon1 = DummyBeaconCreator.CreateBeaconUrsin();
            var beacon2 = DummyBeaconCreator.CreateBeaconMarcel();
            indoorLocationController.AddBeaconsAndStart(new List<Beacon>{beacon1,beacon2});

            if (!IsBluetoothAvailable)
            {
                Toast.MakeText(this, "Please activate Bluetooth! iBeacons works only when Bluetooth available.",ToastLength.Long).Show();
            }
        }
开发者ID:ChallengeEarth,项目名称:beacon-prototype,代码行数:26,代码来源:MainActivity.cs


示例3: OnListItemClick

        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var url = _adapter.GetMapUrl (position);
            var intent = new Intent (Intent.ActionView, Uri.Parse(url));

            StartActivity (intent);
        }
开发者ID:bozood,项目名称:MobileDay,代码行数:7,代码来源:CoffeeListActivity.cs


示例4: DeleteClicked

 private void DeleteClicked(View view)
 {
     var vm = GetViewVm(view);
     _dataContext.DeleteTodo(vm.Todo);
     _todoVms.Remove(vm);
     NotifyDataSetChanged(); // trigger view reset so item disappears
 }
开发者ID:baotnq,项目名称:breeze.sharp.samples,代码行数:7,代码来源:TodoGridAdapter.cs


示例5: Initialize

        private void Initialize (Context ctx)
        {
            var dm = ctx.Resources.DisplayMetrics;
            var inflater = LayoutInflater.FromContext (ctx);

            overlayInset = (int)TypedValue.ApplyDimension (ComplexUnitType.Dip, 45, dm);

            backgroundView = new SliceView (ctx) {
                StartAngle = 0,
                EndAngle = 360,
                Color = emptyPieColor,
            };
            AddView (backgroundView);

            loadingOverlayView = inflater.Inflate (Resource.Layout.PieChartLoading, this, false);
            AddView (loadingOverlayView);

            emptyOverlayView = inflater.Inflate (Resource.Layout.PieChartEmpty, this, false);
            emptyOverlayView.Visibility = ViewStates.Gone;
            AddView (emptyOverlayView);

            statsOverlayView = inflater.Inflate (Resource.Layout.PieChartStats, this, false);
            statsOverlayView.Visibility = ViewStates.Gone;
            AddView (statsOverlayView);

            statsTimeTextView = statsOverlayView.FindViewById<TextView> (Resource.Id.TimeTextView);
            statsMoneyTextView = statsOverlayView.FindViewById<TextView> (Resource.Id.MoneyTextView);

            Click += delegate {
                // Deselect slices on click. The Clickable property is set to true only when a slice is selected.
                ActiveSlice = -1;
            };
            Clickable = false;
        }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:34,代码来源:PieChart.cs


示例6: CreateView

        public virtual View CreateView(View parent, string name, Context context, IAttributeSet attrs)
        {
            // resolve the tag name to a type
            var viewType = ViewTypeResolver.Resolve(name);

            if (viewType == null)
            {
                //MvxBindingTrace.Trace(MvxTraceLevel.Error, "View type not found - {0}", name);
                return null;
            }

            try
            {
                var view = Activator.CreateInstance(viewType, context, attrs) as View;
                if (view == null)
                {
                    MvxBindingTrace.Trace(MvxTraceLevel.Error, "Unable to load view {0} from type {1}", name,
                                          viewType.FullName);
                }
                return view;
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception exception)
            {
                MvxBindingTrace.Trace(MvxTraceLevel.Error,
                                      "Exception during creation of {0} from type {1} - exception {2}", name,
                                      viewType.FullName, exception.ToLongString());
                return null;
            }
        }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:33,代码来源:MvxAndroidViewFactory.cs


示例7: OnViewCreated

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

            ListView.SetClipToPadding (false);
            ListAdapter = new SettingsAdapter ();
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:7,代码来源:SettingsListFragment.cs


示例8: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View v = inflater.Inflate (Resource.Layout.WebViewDialog, container, false);

			txtTitle = v.FindViewById<TextView> (Resource.Id.txt_dialog_title);
			divider = v.FindViewById<View> (Resource.Id.title_divider);
			webView = v.FindViewById<WebView> (Resource.Id.dialog_web_view);

			if (title == null || title.Length < 1) {
				txtTitle.Visibility = divider.Visibility = ViewStates.Gone;
			} else {
				txtTitle.Text = title;
			}

			if (url != null && url.Length > 0) {
				webView.LoadUrl (url);
			}

			if (showOkay) {
				btnOk.Visibility = ViewStates.Visible;
				btnOk.Click += (object sender, EventArgs e) => {
					this.Dismiss ();
				};
			}

			return v;
		}
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:27,代码来源:WebViewDialog.cs


示例9: GetView

		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			var view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);

            view.SetMinimumHeight(150);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule(LayoutRules.AlignParentLeft);

			_caption = new TextView (context);
			SetCaption (Caption);
            view.AddView(_caption, parms);
			
			if (!String.IsNullOrWhiteSpace (Indicator)) {
	            var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
	                                                         ViewGroup.LayoutParams.WrapContent);
	            tparms.SetMargins(5, 3, 5, 5);
	            tparms.AddRule(LayoutRules.CenterVertical);
				tparms.AddRule(LayoutRules.AlignParentRight);
	
	            _text = new TextView (context) {
					Text = Indicator,
					TextSize = 22f
				};
	            view.AddView(_text, tparms);
			}
			return view;
		}
开发者ID:couchbaselabs,项目名称:Andr.Unit,代码行数:30,代码来源:FormattedElement.cs


示例10: OnListItemClick

        public override void OnListItemClick(ListView p0, View p1, int position, long p3)
        {
            Fragment newContent = null;
            switch (position)
            {
                case 0:
                    newContent = new ColorFragment(Resource.Color.red);
                    break;
                case 1:
                    newContent = new ColorFragment(Resource.Color.green);
                    break;
                case 2:
                    newContent = new ColorFragment(Resource.Color.blue);
                    break;
                case 3:
                    newContent = new ColorFragment(Resource.Color.white);
                    break;
                case 4:
                    newContent = new ColorFragment(Resource.Color.black);
                    break;
            }

            if (newContent != null)
                SwitchFragment(newContent);
        }
开发者ID:mamta-bisht,项目名称:SlidingMenuSharp,代码行数:25,代码来源:ColorMenuFragment.cs


示例11: GetChildView

		public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent) {
			View container = View.Inflate(parent.Context, Resource.Layout.list_item_child, null);
			TextView txtGroupName = (TextView)container.FindViewById(Resource.Id.txtExampleName);
			ExampleFragment child = (ExampleFragment)this.GetChild(groupPosition, childPosition);
			txtGroupName.Text = child.Title();
			return container;
		}
开发者ID:bmccool,项目名称:Android-samples,代码行数:7,代码来源:ExamplesAdapter.cs


示例12: CreateTabContent

 public View CreateTabContent(string tag)
 {
     var v = new View(_context);
     v.SetMinimumHeight(0);
     v.SetMinimumWidth(0);
     return v;
 }
开发者ID:slodge,项目名称:MonoDroid.ActionBar,代码行数:7,代码来源:TabsAdapter.cs


示例13: OnCreateView

		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
			view = inflater.Inflate(Resource.Layout.TeamsFragment, container, false);
			if(listTeams.Count == 0) {
				//display text that there are currently no events and hide list with events
				view.FindViewById(Resource.Id.teamsFragmentListTeams).Visibility = ViewStates.Gone;
			} else {
				//display list with events and hide the text
				view.FindViewById(Resource.Id.teamsFragmentNoTeams).Visibility = ViewStates.Gone;

				listView = view.FindViewById<ListView>(Resource.Id.teamsFragmentListTeams);
				listView.Adapter = new ListTeamsAdapter(this, listTeams);
				listView.ItemClick += OnListItemClick;
			}

			if(DB_Communicator.getInstance().isAtLeast(VBUser.GetUserFromPreferences().getUserType(), UserType.Coremember)) {
				view.FindViewById<LinearLayout>(Resource.Id.teamsFragmentBtnAddLine).Visibility = ViewStates.Visible;
			} else {
				view.FindViewById<LinearLayout>(Resource.Id.teamsFragmentBtnAddLine).Visibility = ViewStates.Gone;
			}

			view.FindViewById<Button>(Resource.Id.teamsFragmentBtnAdd).Click += (object sender, EventArgs e) => {
				ViewController.getInstance().mainActivity.switchFragment(ViewController.TEAMS_FRAGMENT, 
					ViewController.ADD_TEAM_FRAGMENT, new AddTeamFragment());
			};

			return view;
		}
开发者ID:Tucaen,项目名称:Karlsfeld-Volleyball-App,代码行数:27,代码来源:TeamsFragment.cs


示例14: GetView

        public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            this.Click = delegate { SelectImage(); };

            Bitmap scaledBitmap = Bitmap.CreateScaledBitmap(_image, dimx, dimy, true);

            var view = convertView as RelativeLayout;
            if (view == null)
            {
                view = new RelativeLayout(context);
                _imageView = new ImageView(context);
            }
            else
            {
                _imageView = (ImageView)view.GetChildAt(0);
            }
            _imageView.SetImageBitmap(scaledBitmap);
            
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule( LayoutRules.AlignParentLeft);
			if(_imageView.Parent != null && _imageView.Parent is ViewGroup)
				((ViewGroup)_imageView.Parent).RemoveView(_imageView);
			view.AddView(_imageView, parms);

            return view;
		}
开发者ID:atsushieno,项目名称:MonoDroid.Dialog,代码行数:27,代码来源:ImageElement.cs


示例15: GetCellCore

		protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
		{
			Performance.Start();
			var cell = (ViewCell)item;

			var container = convertView as ViewCellContainer;
			if (container != null)
			{
				container.Update(cell);
				Performance.Stop();
				return container;
			}

			BindableProperty unevenRows = null, rowHeight = null;
			if (ParentView is TableView)
			{
				unevenRows = TableView.HasUnevenRowsProperty;
				rowHeight = TableView.RowHeightProperty;
			}
			else if (ParentView is ListView)
			{
				unevenRows = ListView.HasUnevenRowsProperty;
				rowHeight = ListView.RowHeightProperty;
			}

			IVisualElementRenderer view = Platform.CreateRenderer(cell.View);
			Platform.SetRenderer(cell.View, view);
			cell.View.IsPlatformEnabled = true;
			var c = new ViewCellContainer(context, view, cell, ParentView, unevenRows, rowHeight);

			Performance.Stop();

			return c;
		}
开发者ID:cosullivan,项目名称:Xamarin.Forms,代码行数:34,代码来源:ViewCellRenderer.cs


示例16: PerformAction

        public override void PerformAction(View view)
        {
            try
            {
                ContentValues eventValues = new ContentValues();

                eventValues.Put( CalendarContract.Events.InterfaceConsts.CalendarId,
                    _calId);
                eventValues.Put(CalendarContract.Events.InterfaceConsts.Title,
                    "Test Event from M4A");
                eventValues.Put(CalendarContract.Events.InterfaceConsts.Description,
                    "This is an event created from Xamarin.Android");
                eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart,
                    GetDateTimeMS(2011, 12, 15, 10, 0));
                eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend,
                    GetDateTimeMS(2011, 12, 15, 11, 0));

                var uri = ContentResolver.Insert(CalendarContract.Events.ContentUri,
                    eventValues);
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.Android, Context);

            }
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:26,代码来源:AddEventToCalAction.cs


示例17: MyHealth_TakwimViewHolder

		public MyHealth_TakwimViewHolder (View itemView, Action<int> listener) : base(itemView)
		{
			tvTitle = itemView.FindViewById <TextView> (Resource.Id.tvCardHeader);
			mRViewList = itemView.FindViewById <RecyclerView> (Resource.Id.takwimRecyclerViewList);

			itemView.Click += (sender, e) => listener (base.Position);
		}
开发者ID:kktanpiya,项目名称:pyongPyaa048,代码行数:7,代码来源:Takwim_RecyclerViewAdapter.cs


示例18: OnListItemClick

        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var person = ((PeopleGroupsAdapter)ListAdapter).GetPerson (position);

            if (person != null)
                StartActivity (PersonActivity.CreateIntent (this, person));
        }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:7,代码来源:SearchActivity.cs


示例19: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                _task = Rep.DatabaseHelper.Tasks.Enumerator.Current;
                var category = Rep.DatabaseHelper.Tasks.GetCategory(_task.CategoryId);
                SetContentView(Resource.Layout.ImageCard);
                _image = FindViewById<ImageView>(Resource.Id.imageCardView);
                var imageIdentifier = this.Resources.GetIdentifier(category.Image, "drawable", this.PackageName);
                _image.SetImageResource(imageIdentifier);

                var text = FindViewById<TextView>(Resource.Id.textCard);
                text.SetTypeface(Rep.FontManager.Get(Font.BankirRetro), TypefaceStyle.Normal);
                text.Text = _task.TaskName;

                _contentFrameLayout = FindViewById(Resource.Id.contentFrameLayout);

                _contentFrameLayout.Click += ContentFrameLayoutOnClick;

            }
            catch (Exception exception)
            {
                GaService.TrackAppException(this.Class,"OnCreate", exception, false);
                base.OnBackPressed();
            }
        }
开发者ID:okrotowa,项目名称:Mosigra.Yorsh,代码行数:27,代码来源:ImageActivity.cs


示例20: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			mWebView = (WebView)view.FindViewById (Resource.Id.web_view);
			// Here, we use #mWebChromeClient with implementation for handling PermissionRequests.
			mWebView.SetWebChromeClient (mWebChromeClient);
			ConfigureWebSettings (mWebView.Settings);
		}
开发者ID:GTmAster,项目名称:monodroid-samples,代码行数:7,代码来源:PermissionRequestFragment.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Views.ViewGroup类代码示例发布时间:2022-05-24
下一篇:
C# Views.MotionEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap