答案 0 :(得分:0)
1首先以水平布局创建编辑文本和图像视图。
2制作图像视图可见错误。将有2个图像true_image和false_image,基于编辑文本值更改图像视图图像。
3编辑文本的方法如下:
for in
希望这个答案可以帮到你。
答案 1 :(得分:0)
您可以使用此代码自定义默认搜索视图
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.xyz, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
if (searchItem != null) {
SearchView searchView = (SearchView) searchItem.getActionView();
if (searchView != null) {
// Full view of search
View searchPlate = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
// Apply customisation as you want
ImageView searchClose =(ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
// Edittext of search view so you can customize this also
EditText searchSourceText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
}
}
}
答案 2 :(得分:0)
更改下划线颜色:
View searchplate =searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
searchplate.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.MULTIPLY);