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


C# View.FindViewById方法代码示例

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


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

示例1: GetInfoContents

		public View GetInfoContents (Marker marker)
		{
			if (view == null) {
				var inflater = context.GetSystemService (Context.LayoutInflaterService).JavaCast<LayoutInflater> ();
				view = inflater.Inflate (Resource.Layout.InfoWindowLayout, null);
				var bikeView = view.FindViewById<ImageView> (Resource.Id.bikeImageView);
				var lockView = view.FindViewById<ImageView> (Resource.Id.lockImageView);
				bikeView.SetImageDrawable (bikeDrawable);
				lockView.SetImageDrawable (lockDrawable);
			}

			var name = view.FindViewById<TextView> (Resource.Id.InfoViewName);
			var bikes = view.FindViewById<TextView> (Resource.Id.InfoViewBikeNumber);
			var slots = view.FindViewById<TextView> (Resource.Id.InfoViewSlotNumber);
			var starButton = view.FindViewById<ToggleButton> (Resource.Id.StarButton); 

			var splitTitle = marker.Title.Split ('|');
			var displayName = splitTitle[1]
				.Split (new string[] { "-", " at " }, StringSplitOptions.RemoveEmptyEntries)
				.FirstOrDefault ();
			Id = int.Parse (splitTitle[0]);
			name.Text = (displayName ?? string.Empty).Trim ();
			var splitNumbers = marker.Snippet.Split ('|');
			bikes.Text = splitNumbers [0];
			slots.Text = splitNumbers [1];

			bool activated = favManager.GetFavoritesStationIds ().Contains (Id);
			starButton.Activated = activated;
			starButton.SetBackgroundDrawable (activated ? starOnDrawable : starOffDrawable);

			return view;
		}
开发者ID:JovinPJ,项目名称:Moyeu,代码行数:32,代码来源:InfoWindowAdapter.cs

示例2: TimeLineViewHolder

 public TimeLineViewHolder(View itemView, int viewType)
     : base(itemView)
 {
     name = itemView.FindViewById<TextView>(Resource.Id.tx_name);
     mTimelineView = itemView.FindViewById<TimelineView>(Resource.Id.time_marker);
     mTimelineView.InitLine(viewType);
 }
开发者ID:huguodong,项目名称:TimeLine,代码行数:7,代码来源:TimeLineViewHolder.cs

示例3: 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

示例4: UnbindPopWindow

		public UnbindPopWindow (Activity _activity,GuardianInfoListItem item)
		{
			activity = _activity;
			LayoutInflater inflater = (LayoutInflater) activity.GetSystemService (Context.LayoutInflaterService);
			contentView = inflater.Inflate(Resource.Layout.customunbinddialogLayout, null);  

			ContentView = contentView;
			Width = 900;
			Height = 450;
			Focusable = true;
			OutsideTouchable = true;
			//Update ();
			SetBackgroundDrawable (new ColorDrawable());
			AnimationStyle = Resource.Style.AnimationPreview;
			var btn_confirm = contentView.FindViewById<Button> (Resource.Id.btn_confirm);
			btn_confirm.Click += (sender, e) => 
			{
				Dismiss();

				if(UnBindEventHandler != null)
					UnBindEventHandler(item);
		
			};
			var btn_cancel = contentView.FindViewById<Button> (Resource.Id.btn_cancel);
			btn_cancel.Click += (sender, e) => 
			{
				Dismiss();
			};

			DismissEvent += (sender, e) => 
			{
				BackgroundAlpha(1f);

			};
		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:35,代码来源:UnbindPopWindow.cs

示例5: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			this.settings = Database.Instance ().GetSettings ();

			Switch vibrate = view.FindViewById<Switch>(Resource.Id.Vibrate);
			vibrate.Checked = this.settings.Vibrate;	
			vibrate.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				this.settings.Vibrate = e.IsChecked;
			};

			Switch sound = view.FindViewById<Switch>(Resource.Id.Sound);
			sound.Checked = this.settings.Sound;
			sound.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				this.settings.Sound = e.IsChecked;					
			};

			Switch autoAcceptVideo = view.FindViewById<Switch>(Resource.Id.AutoAcceptVideo);
			autoAcceptVideo.Checked = this.settings.AutoAcceptVideo;
			autoAcceptVideo.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				this.settings.AutoAcceptVideo = e.IsChecked;
			};

			Button button = view.FindViewById<Button>(Resource.Id.ResetBtn);
			button.Click += (object sender, EventArgs e) => {
				this.ResetMatches();
			};
		}
开发者ID:billy-lokal,项目名称:Dateifi_Old,代码行数:27,代码来源:SettingsFragment.cs

示例6: SetupBankViews

        private void SetupBankViews(View parent)
        {
            var banksSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank);
            var banksBranchSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank_branch);

            var banks = bankRepository.GetAll().ToList();
            var bankNames = banks.Select(b => b.Name).ToList();
            var banksAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item, bankNames);
            banksSpinner.Adapter = banksAdapter;

            var bankBranchesAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item);
            banksBranchSpinner.Adapter = bankBranchesAdapter;

            banksSpinner.ItemSelected += delegate
            {
                this.bank = banks[banksSpinner.SelectedItemPosition];

                var bankBranchNames = bank.Branches.Select(b => b.Name).ToList();
                bankBranchesAdapter.Clear();
                bankBranchesAdapter.AddAll(bankBranchNames);

                banksBranchSpinner.ItemSelected += delegate
                {
                    this.bankBranch = bank.Branches[banksBranchSpinner.SelectedItemPosition];
                };
            };

            bank = banks.First();
            bankBranch = bank.Branches.First();
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:30,代码来源:ReceiveChequePaymentFragment.cs

示例7: OnCreateView

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

			toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);

			//string guestString = Intent.GetStringExtra("user");
			//if (!String.IsNullOrEmpty(guestString))
			//{
			//	Guest = JsonConvert.DeserializeObject<User>(guestString);
			//}


			PostFeedFragment = new PostFeedFragment();
			PostFeedFragment.Master = this;
			PostFeedFragment.EmptyTableString = Strings.no_active_posts;
			PostFeedFragment.NewPageContainerID = Resource.Id.search_container;

			if (Guest != null)
			{
				((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = Guest.username;
				ImageView toolbarImageFarLeft = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarLeft);
				toolbarImageFarLeft.Visibility = ViewStates.Visible;
				Drawable backArrow = Context.Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
				backArrow.SetColorFilter(Resources.GetColor(Resource.Color.tenBlue), PorterDuff.Mode.SrcAtop);
				toolbarImageFarLeft.SetImageDrawable(backArrow);
				toolbarImageFarLeft.Click += (sender, e) =>
				{
					FragmentManager.PopBackStack();
				};

				PostFeedFragment.Target = FeedTypeEnum.FeedType.GuestProfileFeed;
				PostFeedFragment.User = Guest;

				ChildFragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, PostFeedFragment).Commit();
			}
			else {
				((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = Globe.SharedInstance.User.username;
				ImageView toolbarImageFarRight = (ImageView)toolbarLayout.FindViewById(Resource.Id.toolbar_imageFarRight);
				toolbarImageFarRight.Visibility = ViewStates.Visible;
				toolbarImageFarRight.SetImageResource(Resource.Drawable.settings);
				toolbarImageFarRight.Click += (sender, e) =>
				{
					SettingsFragment SettingsFragment = new SettingsFragment();
					PostFeedFragment.Master = this;
					PostFeedFragment.EmptyTableString = Strings.no_active_posts;
					FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container_page, SettingsFragment).AddToBackStack(null).Commit();

				};

				PostFeedFragment.Target = FeedTypeEnum.FeedType.MyProfileFeed;
				PostFeedFragment.User = Globe.SharedInstance.User;

				FragmentManager.BeginTransaction().Add(Resource.Id.fragment_container, PostFeedFragment).Commit();
			}


			return view;

		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:60,代码来源:ProfileFragment.cs

示例8: SelectPicPopWindow

		public SelectPicPopWindow (Activity _activity,View.IOnClickListener listener)
		{
			activity = _activity;
			LayoutInflater inflater = (LayoutInflater) activity.GetSystemService (Context.LayoutInflaterService);
			contentView = inflater.Inflate(Resource.Layout.headImgSelectorPop, null);  
			ContentView = contentView;
			btn_take_photo = contentView.FindViewById<Button> (Resource.Id.btn_take_photo);
			btn_pick_photo = contentView.FindViewById<Button> (Resource.Id.btn_pick_photo);
			btn_cancel = contentView.FindViewById<Button> (Resource.Id.btn_pic_cancel);
			//设置宽度、高度
			Width = Android.Views.ViewGroup.LayoutParams.MatchParent;
			Height = Android.Views.ViewGroup.LayoutParams.WrapContent;
			Focusable = true;
			OutsideTouchable = true;
			SetBackgroundDrawable (new ColorDrawable());
			AnimationStyle = Resource.Style.Animationbottom;

			//设置按钮绑定
			btn_take_photo.SetOnClickListener (listener);
			btn_pick_photo.SetOnClickListener (listener);

			//取消
			btn_cancel.Click += (sender, e) => 
			{
				Dismiss();

			};

			DismissEvent+= (sender, e) => 
			{
				BackgroundAlpha(1f);
			};

		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:34,代码来源:SelectPicPopWindow.cs

示例9: BuildingRowHolder

 public BuildingRowHolder(View view)
 {
     _view = view;
     _nameView = view.FindViewById<TextView>(Resource.Id.buildingname);
     _addressView = view.FindViewById<TextView>(Resource.Id.buildingaddress);
     _distanceView = view.FindViewById<TextView>(Resource.Id.buildingdistance);
 }
开发者ID:topgenorth,项目名称:yegbuildings,代码行数:7,代码来源:BuildingRowHolder.cs

示例10: OnCreateView

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

            taskTitle = rootView.FindViewById<EditText> (Resource.Id.taskTitle);
            taskNote = rootView.FindViewById<EditText> (Resource.Id.taskNote);

            taskAlarmList = rootView.FindViewById<ListView> (Resource.Id.taskAlarmList);
            alarmAdapter = new AlarmAdapter (inflater, alarmList);
            taskAlarmList.Adapter = alarmAdapter;

            taskAlarmList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
            //				Toast.MakeText(Activity, "hoge", ToastLength.Long);
                currentAlarmPosition = e.Position;
                var df = new TimePickerFragment(this);
                df.Show(this.FragmentManager, "timePicker");
            };

            taskTitle.Text = ViewModel.SelectedTask.Title;
            taskNote.Text = ViewModel.SelectedTask.Note;

            // after text changed: viewmodel sync
            taskTitle.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => { ViewModel.SelectedTask.Title = taskTitle.Text; };
            taskNote.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => { ViewModel.SelectedTask.Note = taskNote.Text; };

            return rootView;
        }
开发者ID:ruly-rudel,项目名称:ruly,代码行数:27,代码来源:TaskEditFragment.cs

示例11: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			var count = status == BikeActionStatus.Stop ? station.BikeCount : station.EmptySlotCount;
			var ratio = ((float)count) / station.Capacity;
			var color = InterpolateColor (Color.Rgb (0xff, 0x44, 0x44),
			                              Color.Rgb (0x99, 0xcc, 0x00),
			                              ratio);
			var bg = new RoundRectDrawable (color, TypedValue.ApplyDimension (ComplexUnitType.Dip, 2, view.Resources.DisplayMetrics));

			var countText = view.FindViewById<TextView> (Resource.Id.count);
			countText.Text = count.ToString ();
			countText.SetBackgroundDrawable (bg);

			string secondary;
			var primary = StationUtils.CutStationName (station.Name, out secondary);
			view.FindViewById<TextView> (Resource.Id.stationPrimary).Text = primary;
			view.FindViewById<TextView> (Resource.Id.stationSecondary).Text = secondary;

			var distance = GeoUtils.Distance (currentLocation, station.Location);
			var distanceText = view.FindViewById<TextView> (Resource.Id.distance);
			if (distance < 1)
				distanceText.Text = (distance * 1000).ToString ("N0") + " meters";
			else
				distanceText.Text = distance.ToString ("N1") + " km";
		}
开发者ID:adamgoodrich,项目名称:Moyeu,代码行数:25,代码来源:StationCardFragment.cs

示例12: GetView

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var item = items[position];

            ViewHolder holder;

            if (convertView == null)
            {
                convertView = context.LayoutInflater.Inflate(lay, parent, false) as LinearLayout;

                holder = new ViewHolder();
                holder.ImageItem = convertView.FindViewById<ImageView>(imageItem);
                holder.TextTop = convertView.FindViewById<TextView>(textTop);
                holder.TextBottom = convertView.FindViewById<TextView>(textBottom);
                holder.position = position;
                convertView.SetTag(lay, holder);
            }

            holder = (ViewHolder)convertView.GetTag(lay);

                if (interop.imgs.ContainsKey(item.created_at))
                    holder.ImageItem.SetImageBitmap(interop.imgs[item.created_at]);
                else holder.ImageItem.SetImageResource(Resource.Drawable.avatar_sample);

                holder.TextTop.SetText(item.from_user_name, TextView.BufferType.Normal);
                holder.TextBottom.SetText((item.text.Length < 30) ? item.text : item.text.Substring(0, 30) + "...", TextView.BufferType.Normal);

            return convertView;
        }
开发者ID:JonyferBlack,项目名称:mySharpBot,代码行数:29,代码来源:activity_side.cs

示例13: GetView

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (convertView == null) {
                if (_inflater == null) {
                    _inflater = LayoutInflater.FromContext (_context);
                }

                _cell = new Cell ();
                convertView = _inflater.Inflate (Resource.Layout.treeview_cell_layout, parent, false);
                _cell.icon = convertView.FindViewById<ImageView> (Resource.Id.icon);
                _cell.title = convertView.FindViewById <TextView> (Resource.Id.title);

                convertView.SetTag (Resource.Layout.treeview_cell_layout, _cell);
            } else {
                _cell = (Cell)convertView.GetTag (Resource.Layout.treeview_cell_layout);
            }

            if (_nodes [position].hasChild) {
                if (_nodes [position].nodeType == "folder") {
                    _cell.icon.SetImageResource (Resource.Drawable.folder);
                }else{
                    _cell.icon.SetImageResource (Resource.Drawable.file);
                }
                _cell.icon.Visibility = ViewStates.Visible;
            } else {
                _cell.icon.SetImageResource (Resource.Drawable.folder);
                _cell.icon.Visibility = ViewStates.Visible;
            }

            _cell.title.Text = _nodes [position].title;
            _cell.icon.SetPadding (25*(_nodes[position].level),0,0,0);

            return convertView;
        }
开发者ID:WenF,项目名称:TreeView_Xamarin_Android,代码行数:34,代码来源:TreeViewAdapter.cs

示例14: ViewHolder

 public ViewHolder (View v, Action<int> listener) : base (v)
 {
     color = v.FindViewById (Resource.Id.GroupedEditTimeEntryItemTimeColorView);
     period = (TextView)v.FindViewById (Resource.Id.GroupedEditTimeEntryItemTimePeriodTextView);
     duration = (TextView)v.FindViewById (Resource.Id.GroupedEditTimeEntryItemDurationTextView);
     v.Click += (sender, e) => listener (LayoutPosition);
 }
开发者ID:ZhangLeiCharles,项目名称:mobile,代码行数:7,代码来源:GroupedEditAdapter.cs

示例15: OnViewCreated

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

            var listView = view.FindViewById<ListView>(Resource.Id.listview);
            var toolbar = view.FindViewById<Toolbar>(Resource.Id.toolbar);

            toolbar.Title = "Sticky Header";

            // fragments
            var fragments = new Dictionary<string, Fragment>
            {
                {"List View Sticky Header",new ListViewFragment()},
                {"Parallax Simple Sticky Header",new ParallaxFragment()},
                {"Custom Animation Header",new CustomHeaderFragment()},
                {"Recycler View Header",new RecyclerViewFragment()},
                {"Scroll View Header",new ScrollViewFragment()}
            };
            var items = fragments.Keys.ToArray();

            // items
            listView.Adapter = new ArrayAdapter<string>(Activity, Android.Resource.Layout.SimpleListItem1, items);

            // item selection
            listView.ItemClick += (sender, e) =>
            {
                var fragment = fragments[items[e.Position]];
                ((MainActivity)Activity).LoadFragment(fragment);
            };
        }
开发者ID:pacificIT,项目名称:StickyHeader,代码行数:30,代码来源:MainFragment.cs


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