searchView 颜色 icon 设置
public void initSearchViewActions() {
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.onActionViewExpanded();
searchView.setQueryHint(getString(R.string.search_tips));
searchView.setOnQueryTextListener(this);
searchView.setSubmitButtonEnabled(true);
try {
Field field = searchView.getClass().getDeclaredField("mGoButton");
field.setAccessible(true);
ImageView mGoButton = (ImageView) field.get(searchView);
mGoButton.setImageResource(R.mipmap.ic_menu_search); Field fieldSearch = searchView.getClass().getDeclaredField("mSearchButton");
fieldSearch.setAccessible(true);
ImageView mSearchButton = (ImageView) field.get(searchView);
mSearchButton.setVisibility(View.GONE); Field fieldClear = searchView.getClass().getDeclaredField("mCloseButton");
fieldClear.setAccessible(true);
ImageView mCloseButton = (ImageView) fieldClear.get(searchView);
mCloseButton.setImageResource(R.mipmap.ic_menu_clear); int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);
textView.setHintTextColor(Color.parseColor("#FFFFFF")); Field ownField = searchView.getClass().getDeclaredField("mSearchPlate"); // 注意mSearchPlate的背景是stateListDrawable(不同状态不同的图片)
// 所以不能用BitmapDrawable
// setAccessible 它是用来设置是否有权限访问反射类中的私有属性的,只有设置为true时才可以访问,默认为false
ownField.setAccessible(true);
View mView = (View) ownField.get(searchView);
mView.setBackgroundColor(Color.TRANSPARENT);
} catch (Exception e) {
LogUtil.e(e.getMessage(), e);
} int completeViewId = searchView.getResources().getIdentifier("android:id/search_src_text",null,null);
mAutoCompleteTextView = (AutoCompleteTextView) searchView.findViewById(completeViewId);
mAutoCompleteTextView.setThreshold(0);
mAutoCompleteTextView.setTextColor(Color.parseColor("#ffffff"));
mAutoCompleteTextView.setHintTextColor(Color.parseColor("#ffffff"));
}
searchView 颜色 icon 设置的更多相关文章
- Android中Listview点击item不变颜色以及设置listselector 无效
Android中Listview点击item不变颜色以及设置listselector 无效 这是同一个问题,Listview中点击item是会变颜色的,因为listview设置了默认的listsele ...
- devexpress表格控件gridcontrol设置隔行变色、焦点行颜色、设置(改变)显示值、固定列不移动(附源码)
介绍一些常用的gridcontrol设置. 1.设置隔行变色.首先设置显示隔行变色,步骤:OptionsView-->EnableAppearanceEvenRow-->true和Opti ...
- mac app icon 设置
mac app icon 设置 1:目前 mac app 所需要的icon 图标尺寸 icon_16x16.png 16px icon_16x16@2x.png 32px icon_32x32.png ...
- Eclipse字体颜色的设置方法
Eclipse字体颜色的设置方法.. ----------------- .---------------------此时我们就希望设置一下字体eclipse字体颜色,让他像其它编辑器一样的,有不同的 ...
- emacs24 颜色主题设置
Emacs24 颜色主题设置 在Linux上写程序,永远绕不过的2个东西就是vi和emacs.emacs是早晚要接触的东西.本文就从配置颜色主题(color-theme)开始.用命令:$ sudo a ...
- Python中print字体颜色的设置
Python中print字体颜色的设置 实现过程: 终端的字符颜色是用转义序列控制的,是文本模式下的系统显示功能,和具体的语言无关. 转义序列是以ESC开头,即用\033来完成 ...
- MFC窗口颜色的设置
本文主要介绍对话框背景色以及控件颜色的设置(SetDialogBkColor()不再被支持). 对话框背景色的设置 1.重载OnPaint()函数,即WM_PAINT消息,代码如下所示: void C ...
- CxGrid导出Excel时清除颜色的设置
CxGrid导出Excel时清除颜色的设置 (2011-04-25 16:33:23) 转载▼ 标签: it 分类: Delphi http://www.radxe.com/?p=170 cxgrid ...
- (求助)对某一颜色,设置透明度 alpha 后,其他使用该颜色的地方 受到影响!!!!原因未知
对某一颜色,设置透明度 alpha 后,其他使用该颜色的地方 受到影响!!!!原因未知,有谁碰到过这样的问题?????? 测试了以下三款手机,结果如下: 1.android 4.4.2: 不受影响 2 ...
随机推荐
- 零基础入门学习Python(3)--小插曲之变量和字符串
前言 小甲鱼说,在对前边的小游戏改善前,先了解下,Python中的变量与字符串. 主要内容 变量 变量名就像我们现实社会的名字,把一个值赋值给一个名字时,Ta会存储在内存中,称之为变量(variabl ...
- nginx+redis安装配置(内存型数据库)实现session的共享
注意:借鉴原文章:http://www.cnblogs.com/roy-blog/p/7196054.html 感兴趣的可以加一下481845043 java交流群,共同进步. 1 session的概 ...
- LeetCode(36)Valid Sudoku
题目 Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could ...
- [bzoj2822][AHOI2012]树屋阶梯 (卡特兰数+分解质因数+高精度)
Description 暑假期间,小龙报名了一个模拟野外生存作战训练班来锻炼体魄,训练的第一个晚上,教官就给他们出了个难题.由于地上露营湿气重,必须选择在高处的树屋露营.小龙分配的树屋建立在一颗高度为 ...
- python基础示例
7.写代码 (1)实现用户输入用户名和密码,当用户名为 seven 且 密码为 123 时,显示登陆成功,否则登陆失败! _name = "seven" _pwd = " ...
- jQuery学习之------html()、text()和val()
jQuery学习之------html().text()和val() .html(),.text()和.val()的差异总结: (来源:慕课网) .html(),.text(),.val()三种方法 ...
- L2-001. 紧急救援 (Dijkstra算法打印路径)
作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图.在地图上显示有多个分散的城市和一些连接城市的快速道路.每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上.当其他城市有紧急求 ...
- 在fragment中获取activity的组件
在fragment中使用getActivity()即可获取activity的引用
- Ubuntu 16.04添加多张虚拟网卡
1.添加 sudo ifconfig enp0s31f6:0 192.168.10.10 up 2.卸载 sudo ifconfig enp0s31f6:0 down 注意:enp0s31f6每台电脑 ...
- golang convert integer to float number
There is no float type. Looks like you want float64. You could also use float32 if you only need a s ...