は、カスタムレンダラで、あなたは検索バーの右側にある検索アイコンを配置するには、次のコードを使用することができます。
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
var searchView = base.Control as SearchView;
//Get the Id for your search icon
int searchIconId = Context.Resources.GetIdentifier("android:id/search_mag_icon", null, null);
ImageView searchViewIcon = (ImageView)searchView.FindViewById<ImageView>(searchIconId);
ViewGroup linearLayoutSearchView = (ViewGroup)searchViewIcon.Parent;
searchViewIcon.SetAdjustViewBounds(true);
//Remove the search icon from the view group and add it once again to place it at the end of the view group elements
linearLayoutSearchView.RemoveView(searchViewIcon);
linearLayoutSearchView.AddView(searchViewIcon);
}
}
上記の実装では、私は単に削除します検索バービューグループの検索アイコンをクリックし、同じビューグループに再度追加します。通常、最初の子を最後の子に置き、検索アイコンを最後に配置します。