Problem switching tab

FredrikAxteliusFredrikAxtelius SEBeta ✭✭
edited April 2013 in Xamarin.Android

About to create my first Android app and found the HelloTabsICS sample and article about tabs way down on this page:
http://docs.xamarin.com/guides/android/platform_features/introduction_to_ice_cream_sandwich

Modified the tabs example a little bit so it loads a different fragment for each tab.

When I run it, it kinda works but the screen doesn't "clear" when clicking on a new tab so the text from my newly selected tab gets written on top of the text from fragment 1 (both fragments just have a TextView).

This was in the emulator, left my Android pad @ work so I couldn't test on the real thing.

Anyone had the same problem?

Posts

  • FredrikAxteliusFredrikAxtelius SEBeta ✭✭
    edited April 2013

    Modifying Activity1.cs in HelloTabICS from

    tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { e.FragmentTransaction.Add (Resource.Id.fragmentContainer, new SampleTabFragment ()); };

    to:

    tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { e.FragmentTransaction.Replace (Resource.Id.fragmentContainer, new SampleTabFragment ()); };

    seems to solve the problem.

Sign In or Register to comment.