如何在android中更改搜索视图主页向上箭头或其颜色?

时间:2016-02-16 07:33:51

标签: android xml

enter image description here //更改图片中的箭头颜色或图片如何更改

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
                                  upArrow.setColorFilter(getResources().getColor(R.color.app_theme_color), PorterDuff.Mode.SRC_ATOP);
                                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {`enter code here`
                                    mActionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.arrow));
                                  }

1 个答案:

答案 0 :(得分:0)

您可以像这样更改图标....

希望这会有所帮助......

menu.findItem(R.id.menu_search).setOnActionExpandListener(this); 
    // Your Activity/Fragment must implement the MenuItem.OnActionExpandListener interface

    @Override
    public boolean onMenuItemActionExpand(MenuItem item) {
        getSherlockActivity().getSupportActionBar().setIcon(R.drawable.uvweb_logo);
        return true;
    }