嘿在android(Xamarin)我试图在操作栏中添加标签,但我完成但是当我使用切换按钮时这个错误显示
' FragmentTransaction'是' Android.App.FragmentTransaction'之间的模糊参考。和' Android.Support.V4.App.FragmentTransaction'
这是我的代码
protected override void OnCreate(Bundle bundle)
{
DrawerLayout mDrawerLayout;
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, Resource.Drawable.drawer, Resource.String.open_drawer, Resource.String.close_drawer);
FragmentTransaction transaction = FragmentManager.BeginTransaction();
SlidingTabsFragment fragment = new SlidingTabsFragment();
transaction.Replace(Resource.Id.sample_content_fragment, fragment);
transaction.Commit();
mDrawerLayout.SetDrawerListener(mDrawerToggle);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
}
答案 0 :(得分:1)
使用Android.App.FragmentTransaction transaction = FragmentManager.BeginTransaction();