public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.MatchDetail, container, false); root.FindViewById <TextView>(Resource.Id.leagueName).Text = League.Name + " " + Match.Round.ToString() + ". forduló"; int resourceId = Context.Resources.GetIdentifier(League.Country.ToString().ToLower(), "drawable", Context.PackageName); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { root.FindViewById <ImageView>(Resource.Id.countryFlag).SetImageDrawable(Context.Resources.GetDrawable(resourceId, Context.ApplicationContext.Theme)); } else { root.FindViewById <ImageView>(Resource.Id.countryFlag).SetImageDrawable(Context.Resources.GetDrawable(resourceId)); } root.FindViewById <TextView>(Resource.Id.date).Text = Match.Date.ToShortDateString(); root.FindViewById <TextView>(Resource.Id.stadiumName).Text = Stadium.Name; root.FindViewById <TextView>(Resource.Id.stadiumAddress).Text = Stadium.Address; FragmentManager fm = Activity.SupportFragmentManager; FragmentTransaction ft = fm.BeginTransaction(); Fragment fragment = ListFragment.Instance(Referees.Select(r => new ListModel { Text = r.Name, Object = r }), "referees"); ft.Add(Resource.Id.refereees_container, fragment); ft.Commit(); return(root); }
public static ListFragment Instance(IEnumerable <ListModel> list, string type, string header = "") { var fragment = new ListFragment(); Bundle args = new Bundle(); args.PutString("type", type); args.PutObject("list", list); args.PutString("header", header); fragment.Arguments = args; return(fragment); }