本文整理汇总了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();
}
}
}
示例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");
}
}
}
}
}
}
}
}
示例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");
}
}
}
}
}
}
}
示例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!");
}
}
}
}
}
}
}
示例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
);
}
示例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
));
}