我想要在Xamarin.Android中更改搜索文本视图的颜色。我已经尝试了以下代码:
searchView = this.Activity.FindViewById<Android.Support.V7.Widget.SearchView (Resource.Id.searchView);
searchView.SetOnQueryTextListener(this);
var textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);
var textView = (searchView.FindViewById(textViewId) as TextView);
if (textView != null)
textView.SetTextColor(global::Android.Graphics.Color.White);
当我尝试捕获textView
时,我得到了NULL。
在textViewId
中,我获取了视图的ID,类似于126312727
。
有人能帮我解决上述问题吗?