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

x33g5p2x  于2022-01-30 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(94)

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

SearchView.setBackgroundColor介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

SearchView searchView = new SearchView(getContext());
searchView.setInputType(InputType.TYPE_CLASS_TEXT);
searchView.setBackgroundColor(Color.WHITE);

代码示例来源:origin: stackoverflow.com

SearchView searchView = new SearchView(canvas.getContext());
searchView.setQueryHint("Type your text here");
searchView.setBackgroundColor(Color.WHITE);

OptionCommand searchCommand = new OptionCommand();
searchCommand.setActionView(searchView);
searchCommand.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

代码示例来源:origin: IvanVolosyuk/diskusage

@Override
public boolean finishedSearch(FileSystemSuperRoot newRoot, String searchQuery) {
 boolean matched = super.finishedSearch(newRoot, searchQuery);
 if (matched) {
  searchView.setBackgroundDrawable(origSearchBackground);
 } else {
  searchView.setBackgroundColor(Color.parseColor("#FFDDDD"));
 }
 return matched;
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

private void colorSearchArea() {
  mSearchView.setBackgroundColor(Color.WHITE);
  int searchAreaId = mSearchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
  TextView textView = (TextView) mSearchView.findViewById(searchAreaId);
  textView.setTextColor(mLauncher.getResources().getColor(R.color.blue));
  textView.setHintTextColor(mLauncher.getResources().getColor(R.color.blue_alpha_50));
  textView.setBackgroundColor(Color.WHITE);
  int searchGlassId = mLauncher.getResources().getIdentifier("android:id/search_mag_icon", null, null);
  ImageView searchGlassIcon = (ImageView) mSearchView.findViewById(searchGlassId);
  if (searchGlassIcon != null) {
    searchGlassIcon.setScaleType(ImageView.ScaleType.CENTER);
    searchGlassIcon.setColorFilter(Color.rgb(42, 168, 224));
    searchGlassIcon.setImageResource(R.drawable.ic_all_apps_search);
  }
  int closeId = mLauncher.getResources().getIdentifier("android:id/search_close_btn", null, null);
  ImageView closeBtn = (ImageView) mSearchView.findViewById(closeId);
  if (closeBtn != null) {
    closeBtn.setColorFilter(mLauncher.getResources().getColor(R.color.blue));
    closeBtn.setBackgroundColor(Color.WHITE);
  }
  int searchPlateId = mLauncher.getResources().getIdentifier("android:id/search_plate", null, null);
  LinearLayout searchPlateIcon = (LinearLayout) mSearchView.findViewById(searchPlateId);
  if (searchPlateIcon != null)
    searchPlateIcon.setBackgroundColor(mLauncher.getResources().getColor(R.color.blue));
}

相关文章