android.support.v7.widget.SearchView.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中android.support.v7.widget.SearchView.getContext()方法的一些代码示例,展示了SearchView.getContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SearchView.getContext()方法的具体详情如下:
包路径:android.support.v7.widget.SearchView
类名称:SearchView
方法名:getContext

SearchView.getContext介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public SearchViewAssert hasQueryHint(int resId) {
 isNotNull();
 return hasQueryHint(actual.getContext().getString(resId));
}

代码示例来源:origin: amahi/android

private void setSearchCursor() {
  final int textViewID = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
  final AutoCompleteTextView searchTextView = searchView.findViewById(textViewID);
  try {
    Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
    mCursorDrawableRes.setAccessible(true);
    mCursorDrawableRes.set(searchTextView, R.drawable.white_cursor);
  } catch (Exception ignored) {
  }
}

代码示例来源:origin: algolia/instantsearch-android

/**
 * Returns the context the view is running in, through which it can
 * access the current theme, resources, etc.
 *
 * @return The view's Context.
 */
@NonNull public Context getContext() {
  if (searchView != null) {
    return searchView.getContext();
  } else if (supportView != null) {
    return supportView.getContext();
  }
  throw new IllegalStateException(ERROR_NO_SEARCHVIEW);
}

相关文章