Change SearchView Text Color Xamarin.Android

I want to change the search text view color in Xamarin.Android. I have tried below code so far

        searchView = this.Activity.FindViewById<Android.Support.V7.Widget.SearchView (Resource.Id.searchView);
        var textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);
        var textView = (searchView.FindViewById(textViewId) as TextView);
        if (textView != null)

I am getting NULL when I try to capture the textView

In textViewId I'm getting the id of the view something like 126312727

Can anyone help me on above?

1 answer

  • answered 2018-07-11 06:18 SushiHangover

    This is right out of app using Android.Support.V7.Widget.SearchView

    var id = searchView.Context.Resources.GetIdentifier("search_src_text", "id", PackageName);
    var searchEditText = searchView.FindViewById<EditText>(id);