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


C# android.findViewById方法代码示例

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


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

示例1: getView

			public override android.view.View getView(int position, android.view.View convertView
				, android.view.ViewGroup parent)
			{
				int itemViewType = this.getItemViewType(position);
				switch (itemViewType)
				{
					case ITEM_VIEW_TYPE_FOOTER:
					{
						if (convertView == null || convertView.getId() != ITEM_VIEW_TYPE_FOOTER)
						{
							convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
								([email protected]_chooser_view_list_item, parent, false);
							convertView.setId(ITEM_VIEW_TYPE_FOOTER);
							android.widget.TextView titleView = (android.widget.TextView)convertView.findViewById
								([email protected]);
							titleView.setText(java.lang.CharSequenceProxy.Wrap(this._enclosing.mContext.getString
								([email protected]@string.activity_chooser_view_see_all)));
						}
						return convertView;
					}

					case ITEM_VIEW_TYPE_ACTIVITY:
					{
						if (convertView == null || convertView.getId() != [email protected]_item)
						{
							convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
								([email protected]_chooser_view_list_item, parent, false);
						}
						android.content.pm.PackageManager packageManager = this._enclosing.mContext.getPackageManager
							();
						// Set the icon
						android.widget.ImageView iconView = (android.widget.ImageView)convertView.findViewById
							([email protected]);
						android.content.pm.ResolveInfo activity = (android.content.pm.ResolveInfo)this.getItem
							(position);
						iconView.setImageDrawable(activity.loadIcon(packageManager));
						// Set the title.
						android.widget.TextView titleView_1 = (android.widget.TextView)convertView.findViewById
							([email protected]);
						titleView_1.setText(activity.loadLabel(packageManager));
						// Highlight the default.
						if (this.mShowDefaultActivity && position == 0 && this.mHighlightDefaultActivity)
						{
							convertView.setActivated(true);
						}
						else
						{
							convertView.setActivated(false);
						}
						return convertView;
					}

					default:
					{
						throw new System.ArgumentException();
					}
				}
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:58,代码来源:ActivityChooserView.cs

示例2: bindView

		private void bindView(int position, android.view.View view)
		{
			java.util.Map<string, object> dataSet = mData.get(position);
			if (dataSet == null)
			{
				return;
			}
			android.widget.SimpleAdapter.ViewBinder binder = mViewBinder;
			string[] from = mFrom;
			int[] to = mTo;
			int count = to.Length;
			{
				for (int i = 0; i < count; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						object data = dataSet.get(from[i]);
						string text = data == null ? string.Empty : data.ToString();
						if (text == null)
						{
							text = string.Empty;
						}
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, data, text);
						}
						if (!bound)
						{
							if (v is android.widget.Checkable)
							{
								if (data is bool)
								{
									((android.widget.Checkable)v).setChecked((bool)data);
								}
								else
								{
									if (v is android.widget.TextView)
									{
										// Note: keep the instanceof TextView check at the bottom of these
										// ifs since a lot of views are TextViews (e.g. CheckBoxes).
										setViewText((android.widget.TextView)v, text);
									}
									else
									{
										throw new System.InvalidOperationException(v.GetType().FullName + " should be bound to a Boolean, not a "
											 + (data == null ? "<unknown type>" : data.GetType().ToString()));
									}
								}
							}
							else
							{
								if (v is android.widget.TextView)
								{
									// Note: keep the instanceof TextView check at the bottom of these
									// ifs since a lot of views are TextViews (e.g. CheckBoxes).
									setViewText((android.widget.TextView)v, text);
								}
								else
								{
									if (v is android.widget.ImageView)
									{
										if (data is int)
										{
											setViewImage((android.widget.ImageView)v, (int)data);
										}
										else
										{
											setViewImage((android.widget.ImageView)v, text);
										}
									}
									else
									{
										throw new System.InvalidOperationException(v.GetType().FullName + " is not a " + 
											" view that can be bounds by this SimpleAdapter");
									}
								}
							}
						}
					}
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:84,代码来源:SimpleAdapter.cs

示例3: bindView

		public override void bindView(android.view.View view, android.content.Context context
			, android.database.Cursor cursor)
		{
			android.widget.SimpleCursorAdapter.ViewBinder binder = mViewBinder;
			int count = mTo.Length;
			int[] from = mFrom;
			int[] to = mTo;
			{
				for (int i = 0; i < count; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, cursor, from[i]);
						}
						if (!bound)
						{
							string text = cursor.getString(from[i]);
							if (text == null)
							{
								text = string.Empty;
							}
							if (v is android.widget.TextView)
							{
								setViewText((android.widget.TextView)v, text);
							}
							else
							{
								if (v is android.widget.ImageView)
								{
									setViewImage((android.widget.ImageView)v, text);
								}
								else
								{
									throw new System.InvalidOperationException(v.GetType().FullName + " is not a " + 
										" view that can be bounds by this SimpleCursorAdapter");
								}
							}
						}
					}
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:46,代码来源:SimpleCursorAdapter.cs

示例4: bindView

		private void bindView(android.view.View view, android.content.Context context, android.database.Cursor
			 cursor, int[] from, int[] to)
		{
			android.widget.SimpleCursorTreeAdapter.ViewBinder binder = mViewBinder;
			{
				for (int i = 0; i < to.Length; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, cursor, from[i]);
						}
						if (!bound)
						{
							string text = cursor.getString(from[i]);
							if (text == null)
							{
								text = string.Empty;
							}
							if (v is android.widget.TextView)
							{
								setViewText((android.widget.TextView)v, text);
							}
							else
							{
								if (v is android.widget.ImageView)
								{
									setViewImage((android.widget.ImageView)v, text);
								}
								else
								{
									throw new System.InvalidOperationException("SimpleCursorTreeAdapter can bind values"
										 + " only to TextView and ImageView!");
								}
							}
						}
					}
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:43,代码来源:SimpleCursorTreeAdapter.cs

示例5: ChildViewCache

			public ChildViewCache(android.view.View v)
			{
				mText1 = (android.widget.TextView)v.findViewById([email protected]);
				mText2 = (android.widget.TextView)v.findViewById([email protected]);
				mIcon1 = (android.widget.ImageView)v.findViewById([email protected]);
				mIcon2 = (android.widget.ImageView)v.findViewById([email protected]);
				mIconRefine = (android.widget.ImageView)v.findViewById([email protected]_query
					);
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:9,代码来源:SuggestionsAdapter.cs

示例6: init

		private void init(android.view.View decor)
		{
			mContext = decor.getContext();
			mActionView = ([email protected])decor.findViewById([email protected]
				.id.action_bar);
			mContextView = ([email protected])decor.findViewById(
				[email protected]_context_bar);
			mContainerView = ([email protected])decor.findViewById(
				[email protected]_bar_container);
			mSplitView = ([email protected])decor.findViewById([email protected]
				.id.split_action_bar);
			if (mActionView == null || mContextView == null || mContainerView == null)
			{
				throw new System.InvalidOperationException(GetType().Name + " can only be used " 
					+ "with a compatible window decor layout");
			}
			mActionView.setContextView(mContextView);
			mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
			// Older apps get the home button interaction enabled by default.
			// Newer apps need to enable it explicitly.
			setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < android.os.Build
				.VERSION_CODES.ICE_CREAM_SANDWICH);
			setHasEmbeddedTabs(mContext.getResources().getBoolean([email protected]@bool.action_bar_embed_tabs
				));
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:25,代码来源:ActionBarImpl.cs


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