1

I am adding a android.widget.SearchView to a view in code but I cannot find how to set the text colour for this.

SearchView = new SearchView(getContext());

I see that there are methods to set the text alignment and direction.

I also see that I can set the background colour and tint but nothing for the foreground.

David Pilkington
  • 13,528
  • 3
  • 41
  • 73

1 Answers1

0

Try This

int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null,
null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);

Is it possible to change the textcolor on an Android SearchView?

Community
  • 1
  • 1
Naveen Tamrakar
  • 3,349
  • 1
  • 19
  • 28