MSearchEditFrame = findViewById(R.id.search_edit_frame) MSearchButton = findViewById(R.id.search_button) This excerpt is from Android source code (SearchView.java) For the lazy ones, here are some of those references that you can retrieve (and play with). You can get all the references in either the Android code for SearchView.java, or in its layout. ImageView closeButtonImage = (ImageView) searchView.findViewById(closeButtonId) ĬtImageResource(R.drawable.ic_action_cancel) Īnd so on. int closeButtonId = getResources().getIdentifier("android:id/search_close_btn", null, null) tTextColor(Color.WHITE) tHintTextColor(Color.LTGRAY) įor changing the close icon, this one. int searchSrcTextId = getResources().getIdentifier("android:id/search_src_text", null, null) ĮditText searchEditText = (EditText) searchView.findViewById(searchSrcTextId) With a reference to your SearchView object in there, you can start doing things.įor example, if you'd like to get a reference to its EditText, you could do it using reflection like in this snippet. I had almost everything solved with a custom theme, but it all came down to style a SearchView widget of an ActionBar.Īll of this must happen in your onCreateOptionsMenu method. I stumbled upon a problem with the styling of a view at work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |