public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.fragment_menu, container, false); // Make sure the two menu fragments are created. FragmentManager fm = GetChildFragmentManager(); FragmentTransaction ft = fm.BeginTransaction(); mFragment1 = fm.FindFragmentByTag("f1"); if (mFragment1 == null) { mFragment1 = new FragmentMenuSupport.MenuFragment(); ft.Add(mFragment1, "f1"); } mFragment2 = fm.FindFragmentByTag("f2"); if (mFragment2 == null) { mFragment2 = new FragmentMenuSupport.Menu2Fragment(); ft.Add(mFragment2, "f2"); } ft.Commit(); // Watch check box clicks. mCheckBox1 = (CheckBox)v.FindViewById(R.Ids.menu1); mCheckBox1.Click += (o, a) => UpdateFragmentVisibility(); mCheckBox2 = (CheckBox)v.FindViewById(R.Ids.menu2); mCheckBox2.Click += (o, a) => UpdateFragmentVisibility(); // Make sure fragments start out with correct visibility. UpdateFragmentVisibility(); return v; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.hello_world, container, false); View tv = v.FindViewById(R.Ids.text); ((TextView)tv).SetText("This is an instance of MyDialogFragment"); return v; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.fragment_stack, container, false); // Watch for button clicks. Button button = (Button)v.FindViewById(R.Ids.new_fragment); button.Click += (o,a) => AddFragmentToStack(); button = (Button)v.FindViewById(R.Ids.delete_fragment); button.Click += (o,a) => GetChildFragmentManager().PopBackStack(); button = (Button)v.FindViewById(R.Ids.home); button.Click += (o, a) => { // If there is a back stack, pop it all. FragmentManager fm = GetChildFragmentManager(); if (fm.GetBackStackEntryCount() > 0) { fm.PopBackStack(fm.GetBackStackEntryAt(0).GetId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); }; }; return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { // If recreated on screen orientation changed, game == null, check for that View v = null; if (game != null) { v = game.CreateView(inflater, container); } return v; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.fragment_retain_instance, container, false); // Watch for button clicks. Button button = (Button)v.FindViewById(R.Ids.restart); button.Click += (o,a) => mWorkFragment.Restart(); return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(R.Layouts.PilotListCounterFragment_Layout, container, false); var listview = view.FindViewById<ListView>(R.Ids.pilotListCounterView); listview.ItemClick += new EventHandler<ItemClickEventArgs>(listview_ItemClick); Refresh(view); return view; }
View ITask.CreateView(LayoutInflater inflater, ViewGroup container) { v = inflater.Inflate(layoutId, container, false); tts = new Text2Speech(v.GetContext()); // Create all parts from, for instance, a xml file var s = factory.GetNextGameObjects(v.GetContext(), tts); CreateTask(v, s); return v; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.labeled_text_edit, container, false); View tv = v.FindViewById(R.Ids.msg); ((TextView)tv).SetText("The fragment saves and restores this text."); // Retrieve the text editor, and restore the last saved state if needed. mTextView = (TextView)v.FindViewById(R.Ids.saved); if (savedInstanceState != null) { mTextView.SetText(savedInstanceState.GetCharSequence("text")); } return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); if (details == null) { return inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Blank_Layout, container, false); } View view = inflater.Inflate(R.Layouts.ItemProducersTabFragment_Layout, container, false); Refresh(view); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(R.Layouts.PilotsStatsListFragment_Layout, container, false); var textTitle = view.FindViewById<TextView>(R.Ids.pilotStatsTextTitle); textTitle.Text = mTitle; var listview = view.FindViewById<ListView>(R.Ids.pilotStatsListView); listview.Adapter = mStats; listview.ItemClick += new EventHandler<ItemClickEventArgs>(listview_ItemClick); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); if (details == null) { return inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Blank_Layout, container, false); } View view; switch (details.ItemType) { case ItemType.COMMODITY: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Commodity_Layout, container, false); break; case ItemType.ECM: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_ECM_Layout, container, false); break; case ItemType.SHIELD: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Shield_Layout, container, false); break; case ItemType.CAPACITOR: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Capacitor_Layout, container, false); break; case ItemType.ENGINE: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Engine_Layout, container, false); break; case ItemType.POWERPLANT: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_PowerPlant_Layout, container, false); break; case ItemType.RADAR: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Radar_Layout, container, false); break; case ItemType.MODX: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_MODx_Layout, container, false); break; case ItemType.GUN: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Gun_Layout, container, false); break; case ItemType.MISSILE: view = inflater.Inflate(R.Layouts.ItemDetailsTabFragment_Missile_Layout, container, false); break; default: throw new Exception("Item Type not supported"); } Refresh(view); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(R.Layouts.StationInventoryListFragment_Layout, container, false); var listview = view.FindViewById<ListView>(R.Ids.stationInventoryListView); listview.Adapter = mInventory; if ((mInventory != null) && (mInventory.Count > 50)) { listview.SetFastScrollEnabled(true); } listview.ItemClick += new EventHandler<ItemClickEventArgs>(listview_ItemClick); return view; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { mTabHost = new FragmentTabHost(GetActivity()); mTabHost.Setup(GetActivity(), GetChildFragmentManager(), R.Ids.fragment1); mTabHost.AddTab(mTabHost.NewTabSpec("simple").SetIndicator("Simple"), typeof(FragmentStackSupport.CountingFragment), null); mTabHost.AddTab(mTabHost.NewTabSpec("contacts").SetIndicator("Contacts"), typeof(LoaderCursorSupport.CursorLoaderListFragment), null); mTabHost.AddTab(mTabHost.NewTabSpec("custom").SetIndicator("Custom"), typeof(LoaderCustomSupport.AppListFragment), null); mTabHost.AddTab(mTabHost.NewTabSpec("throttle").SetIndicator("Throttle"), typeof(LoaderThrottleSupport.ThrottledLoaderListFragment), null); return mTabHost; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.receive_result, container, false); // Retrieve the TextView widget that will display results. mResults = (TextView)v.FindViewById(R.Ids.results); // This allows us to later extend the text buffer. mResults.SetText(mResults.GetText(), TextView.BufferType.EDITABLE); // Watch for button clicks. Button getButton = (Button)v.FindViewById(R.Ids.get); getButton.Click += (o, a) => { // Start the activity whose result we want to retrieve. The // result will come back with request code GET_CODE. Intent intent = new Intent(GetActivity(), typeof(SendResult)); StartActivityForResult(intent, GET_CODE); }; return v; }
/** * The Fragment's UI is just a simple text view showing its * instance number. */ public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.fragment_pager_list, container, false); View tv = v.FindViewById(R.Ids.text); ((TextView)tv).SetText("Fragment #" + mNum); return v; }
/** * Create the view for this fragment, using the arguments given to it. */ public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.hello_world, container, false); View tv = v.FindViewById(R.Ids.text); ((TextView)tv).SetText(mLabel != null ? mLabel : "(no label)"); tv.SetBackgroundDrawable(GetResources().GetDrawable(global::Android.R.Drawable.Gallery_thumb)); return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.Inflate(R.Layouts.LeftFragment, container, false); }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // We have different layouts, and in one of them this // fragment's containing frame doesn't exist. The fragment // may still be created from its saved state, but there is // no reason to try to create its view hierarchy because it // won't be displayed. Note this is not needed -- we could // just run the code below, where we would create and return // the view hierarchy; it would just never be used. return null; } ScrollView scroller = new ScrollView(GetActivity()); TextView text = new TextView(GetActivity()); int pAdding = (int)TypedValue.ApplyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, GetActivity().GetResources().GetDisplayMetrics()); text.SetPadding(pAdding, pAdding, pAdding, pAdding); scroller.AddView(text); text.SetText(Shakespeare.DIALOGUE[GetShownIndex()]); return scroller; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.labeled_text_edit, container, false); View tv = v.FindViewById(R.Ids.msg); ((TextView)tv).SetText("The TextView saves and restores this text."); // Retrieve the text editor and tell it to save and restore its state. // Note that you will often set this in the layout XML, but since // we are sharing our layout with the other fragment we will customize // it here. ((TextView)v.FindViewById(R.Ids.saved)).SetSaveEnabled(true); return v; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View root = Inflater.Inflate(R.Layouts.fragment_context_menu, container, false); RegisterForContextMenu(root.FindViewById(R.Ids.long_press)); return root; }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layouts.fragment_dialog, container, false); View tv = v.FindViewById(R.Ids.text); ((TextView)tv).SetText("Dialog #" + mNum + ": using style " + GetNameForNum(mNum)); // Watch for button clicks. Button button = (Button)v.FindViewById(R.Ids.show); button.Click += (o, a) => ((FragmentDialogSupport)GetActivity()).ShowDialog(); return v; }