Monday, July 18, 2011

Re: [android-developers] Re: ActionBar/Mode Style Regressions with SDK 12r2 and 13r1

I've found only one way to change default search view icon:-) But this is terrible solution

SearchView sv = new SearchView(mActivity);
sv.setOnQueryTextListener(mOnSearchQueryTextListener);
menuItemSearch.setActionView(sv);
searchViewChangeHack(sv);

    private static int sViewIndex = 0;

    private void searchViewChangeHack(ViewGroup sv) {
        for (int i = 0; i < sv.getChildCount(); i++) {
            View v = sv.getChildAt(i);
            if (v instanceof ViewGroup) {
                searchViewChangeHack((ViewGroup)v);
            } else if (v instanceof ImageView) {
                if (sViewIndex == 0 || sViewIndex == 1) {
                    ((ImageView) v).setImageResource(R.drawable.common_bar_search);
                }
                sViewIndex++;
            }
        }
    }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment