本文整理汇总了C#中android.getSystemService方法的典型用法代码示例。如果您正苦于以下问题:C# android.getSystemService方法的具体用法?C# android.getSystemService怎么用?C# android.getSystemService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.getSystemService方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResourceCursorAdapter
/// <summary>
/// Constructor with default behavior as per
/// <see cref="CursorAdapter.CursorAdapter(android.content.Context, android.database.Cursor, bool)
/// ">CursorAdapter.CursorAdapter(android.content.Context, android.database.Cursor, bool)
/// </see>
/// ; it is recommended
/// you not use this, but instead
/// <see cref="ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, int)
/// ">ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, int)
/// </see>
/// .
/// When using this constructor,
/// <see cref="CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER">CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER
/// </see>
/// will always be set.
/// </summary>
/// <param name="context">The context where the ListView associated with this adapter is running
/// </param>
/// <param name="layout">
/// resource identifier of a layout file that defines the views
/// for this list item. Unless you override them later, this will
/// define both the item views and the drop down views.
/// </param>
/// <param name="c">The cursor from which to get the data.</param>
/// <param name="autoRequery">
/// If true the adapter will call requery() on the
/// cursor whenever it changes so the most recent
/// data is always displayed. Using true here is discouraged.
/// </param>
public ResourceCursorAdapter(android.content.Context context, int layout, android.database.Cursor
c, bool autoRequery) : base(context, c, autoRequery)
{
mLayout = mDropDownLayout = layout;
mInflater = (android.view.LayoutInflater)context.getSystemService(android.content.Context
.LAYOUT_INFLATER_SERVICE);
}
示例2: SimpleAdapter
/// <summary>Constructor</summary>
/// <param name="context">The context where the View associated with this SimpleAdapter is running
/// </param>
/// <param name="data">
/// A List of Maps. Each entry in the List corresponds to one row in the list. The
/// Maps contain the data for each row, and should include all the entries specified in
/// "from"
/// </param>
/// <param name="resource">
/// Resource identifier of a view layout that defines the views for this list
/// item. The layout file should include at least those named views defined in "to"
/// </param>
/// <param name="from">
/// A list of column names that will be added to the Map associated with each
/// item.
/// </param>
/// <param name="to">
/// The views that should display column in the "from" parameter. These should all be
/// TextViews. The first N views in this list are given the values of the first N columns
/// in the from parameter.
/// </param>
public SimpleAdapter(android.content.Context context, java.util.List<java.util.Map
<string, object>> data, int resource, string[] from, int[] to)
{
mData = data;
mResource = mDropDownResource = resource;
mFrom = from;
mTo = to;
mInflater = (android.view.LayoutInflater)context.getSystemService(android.content.Context
.LAYOUT_INFLATER_SERVICE);
}
示例3: ResourceCursorTreeAdapter
/// <summary>Constructor.</summary>
/// <remarks>Constructor.</remarks>
/// <param name="context">
/// The context where the ListView associated with this
/// SimpleListItemFactory is running
/// </param>
/// <param name="cursor">The database cursor</param>
/// <param name="collapsedGroupLayout">
/// resource identifier of a layout file that
/// defines the views for collapsed groups.
/// </param>
/// <param name="expandedGroupLayout">
/// resource identifier of a layout file that
/// defines the views for expanded groups.
/// </param>
/// <param name="childLayout">
/// resource identifier of a layout file that defines the
/// views for all children but the last..
/// </param>
/// <param name="lastChildLayout">
/// resource identifier of a layout file that defines
/// the views for the last child of a group.
/// </param>
public ResourceCursorTreeAdapter(android.content.Context context, android.database.Cursor
cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout, int
lastChildLayout) : base(cursor, context)
{
mCollapsedGroupLayout = collapsedGroupLayout;
mExpandedGroupLayout = expandedGroupLayout;
mChildLayout = childLayout;
mLastChildLayout = lastChildLayout;
mInflater = (android.view.LayoutInflater)context.getSystemService(android.content.Context
.LAYOUT_INFLATER_SERVICE);
}
示例4: ZoomControls
public ZoomControls(android.content.Context context, android.util.AttributeSet attrs
) : base(context, attrs)
{
setFocusable(false);
android.view.LayoutInflater inflater = (android.view.LayoutInflater)context.getSystemService
(android.content.Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate([email protected]_controls, this, true);
// we are the parent
mZoomIn = (android.widget.ZoomButton)findViewById([email protected]);
mZoomOut = (android.widget.ZoomButton)findViewById([email protected]
);
}
示例5: from
/// <summary>Obtains the LayoutInflater from the given context.</summary>
/// <remarks>Obtains the LayoutInflater from the given context.</remarks>
public static android.view.LayoutInflater from(android.content.Context context)
{
android.view.LayoutInflater LayoutInflater_1 = (android.view.LayoutInflater)context
.getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
if (LayoutInflater_1 == null)
{
throw new java.lang.AssertionError("LayoutInflater not found.");
}
return LayoutInflater_1;
}
示例6: PopupWindow
/// <summary>
/// <p>Create a new, empty, non focusable popup window of dimension (0,0).</p>
/// <p>The popup does not provide a background.</p>
/// </summary>
public PopupWindow(android.content.Context context, android.util.AttributeSet attrs
, int defStyleAttr, int defStyleRes)
{
mOnScrollChangedListener = new _OnScrollChangedListener_131(this);
mContext = context;
mWindowManager = (android.view.WindowManager)context.getSystemService(android.content.Context
.WINDOW_SERVICE);
android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
.styleable.PopupWindow, defStyleAttr, defStyleRes);
mBackground = a.getDrawable([email protected]_popupBackground
);
int animStyle = a.getResourceId([email protected]_popupAnimationStyle
, -1);
mAnimationStyle = animStyle == [email protected]_PopupWindow ?
-1 : animStyle;
// If this is a StateListDrawable, try to find and store the drawable to be
// used when the drop-down is placed above its anchor view, and the one to be
// used when the drop-down is placed below its anchor view. We extract
// the drawables ourselves to work around a problem with using refreshDrawableState
// that it will take into account the padding of all drawables specified in a
// StateListDrawable, thus adding superfluous padding to drop-down views.
//
// We assume a StateListDrawable will have a drawable for ABOVE_ANCHOR_STATE_SET and
// at least one other drawable, intended for the 'below-anchor state'.
if (mBackground is android.graphics.drawable.StateListDrawable)
{
android.graphics.drawable.StateListDrawable background = (android.graphics.drawable.StateListDrawable
)mBackground;
// Find the above-anchor view - this one's easy, it should be labeled as such.
int aboveAnchorStateIndex = background.getStateDrawableIndex(ABOVE_ANCHOR_STATE_SET
);
// Now, for the below-anchor view, look for any other drawable specified in the
// StateListDrawable which is not for the above-anchor state and use that.
int count = background.getStateCount();
int belowAnchorStateIndex = -1;
{
for (int i = 0; i < count; i++)
{
if (i != aboveAnchorStateIndex)
{
belowAnchorStateIndex = i;
break;
}
}
}
// Store the drawables we found, if we found them. Otherwise, set them both
// to null so that we'll just use refreshDrawableState.
if (aboveAnchorStateIndex != -1 && belowAnchorStateIndex != -1)
{
mAboveAnchorBackgroundDrawable = background.getStateDrawable(aboveAnchorStateIndex
);
mBelowAnchorBackgroundDrawable = background.getStateDrawable(belowAnchorStateIndex
);
}
else
{
mBelowAnchorBackgroundDrawable = null;
mAboveAnchorBackgroundDrawable = null;
}
}
a.recycle();
}
示例7: SearchView
public SearchView(android.content.Context context, android.util.AttributeSet attrs
) : base(context, attrs)
{
mShowImeRunnable = new _Runnable_137(this);
mUpdateDrawableStateRunnable = new _Runnable_148(this);
mOnClickListener = new _OnClickListener_787(this);
mTextKeyListener = new _OnKeyListener_836(this);
mOnEditorActionListener = new _OnEditorActionListener_1059(this);
mOnItemClickListener = new _OnItemClickListener_1233(this);
mOnItemSelectedListener = new _OnItemSelectedListener_1244(this);
mTextWatcher = new _TextWatcher_1530(this);
android.view.LayoutInflater inflater = (android.view.LayoutInflater)context.getSystemService
(android.content.Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate([email protected]_view, this, true);
mSearchButton = findViewById([email protected]_button);
mQueryTextView = (android.widget.SearchView.SearchAutoComplete)findViewById([email protected]
.id.search_src_text);
mQueryTextView.setSearchView(this);
mSearchEditFrame = findViewById([email protected]_edit_frame);
mSearchPlate = findViewById([email protected]_plate);
mSubmitArea = findViewById([email protected]_area);
mSubmitButton = findViewById([email protected]_go_btn);
mCloseButton = (android.widget.ImageView)findViewById([email protected]_close_btn
);
mVoiceButton = findViewById([email protected]_voice_btn);
mSearchHintIcon = (android.widget.ImageView)findViewById([email protected]_mag_icon
);
mSearchButton.setOnClickListener(mOnClickListener);
mCloseButton.setOnClickListener(mOnClickListener);
mSubmitButton.setOnClickListener(mOnClickListener);
mVoiceButton.setOnClickListener(mOnClickListener);
mQueryTextView.setOnClickListener(mOnClickListener);
mQueryTextView.addTextChangedListener(mTextWatcher);
mQueryTextView.setOnEditorActionListener(mOnEditorActionListener);
mQueryTextView.setOnItemClickListener(mOnItemClickListener);
mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener);
mQueryTextView.setOnKeyListener(mTextKeyListener);
mQueryTextView.setOnFocusChangeListener(new _OnFocusChangeListener_265(this));
android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
.styleable.SearchView, 0, 0);
setIconifiedByDefault(a.getBoolean([email protected]_iconifiedByDefault
, true));
int maxWidth = a.getDimensionPixelSize([email protected]_maxWidth
, -1);
if (maxWidth != -1)
{
setMaxWidth(maxWidth);
}
java.lang.CharSequence queryHint = a.getText([email protected]_queryHint
);
if (!android.text.TextUtils.isEmpty(queryHint))
{
setQueryHint(queryHint);
}
int imeOptions = a.getInt([email protected]_imeOptions, -1
);
if (imeOptions != -1)
{
setImeOptions(imeOptions);
}
int inputType = a.getInt([email protected]_inputType, -1);
if (inputType != -1)
{
setInputType(inputType);
}
a.recycle();
bool focusable = true;
a = context.obtainStyledAttributes(attrs, [email protected], 0,
0);
focusable = a.getBoolean([email protected]_focusable, focusable);
a.recycle();
setFocusable(focusable);
mVoiceWebSearchIntent = new android.content.Intent(android.speech.RecognizerIntent
.ACTION_WEB_SEARCH);
mVoiceWebSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
mVoiceWebSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL
, android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
mVoiceAppSearchIntent = new android.content.Intent(android.speech.RecognizerIntent
.ACTION_RECOGNIZE_SPEECH);
mVoiceAppSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
mDropDownAnchor = findViewById(mQueryTextView.getDropDownAnchor());
if (mDropDownAnchor != null)
{
mDropDownAnchor.addOnLayoutChangeListener(new _OnLayoutChangeListener_313(this));
}
updateViewsVisibility(mIconifiedByDefault);
updateQueryHint();
}
示例8: makeText
/// <summary>Make a standard toast that just contains a text view.</summary>
/// <remarks>Make a standard toast that just contains a text view.</remarks>
/// <param name="context">
/// The context to use. Usually your
/// <see cref="android.app.Application">android.app.Application</see>
/// or
/// <see cref="android.app.Activity">android.app.Activity</see>
/// object.
/// </param>
/// <param name="text">The text to show. Can be formatted text.</param>
/// <param name="duration">
/// How long to display the message. Either
/// <see cref="LENGTH_SHORT">LENGTH_SHORT</see>
/// or
/// <see cref="LENGTH_LONG">LENGTH_LONG</see>
/// </param>
public static android.widget.Toast makeText(android.content.Context context, java.lang.CharSequence
text, int duration)
{
android.widget.Toast result = new android.widget.Toast(context);
android.view.LayoutInflater inflate = (android.view.LayoutInflater)context.getSystemService
(android.content.Context.LAYOUT_INFLATER_SERVICE);
android.view.View v = inflate.inflate([email protected]_notification
, null);
android.widget.TextView tv = (android.widget.TextView)v.findViewById([email protected]
.id.message);
tv.setText(text);
result.mNextView = v;
result.mDuration = duration;
return result;
}