适配器中的Xamarin片段切换

时间:2014-12-02 08:52:32

标签: android xamarin

点击按钮替换xamarin android中的片段,但是我无法用适配器类中的其他片段切换我的片段。

swagBtn.Click += delegate(object sender, EventArgs e)
{
    var events = new Events();
    var BaseFragments = new BaseFragments();

    BaseFragments.FragmentReplaceWithOutBackstak(
        "",
        Resource.Id.main_container,
        events,
        Resource.Animator.enter,
        Resource.Animator.exit,
        Resource.Animator.pop_enter,
        Resource.Animator.pop_exit
    );
};

这是FragmentReplaceWithOutBackstak方法

public void FragmentReplaceWithOutBackstak(
    String str,
    int continer,
    Android.Support.V4.App.Fragment Class,
    int anim_first,
    int anim_second,
    int anim_third,
    int anim_fourth
)
{
    Activity.SupportFragmentManager
        .BeginTransaction()
        .SetCustomAnimations(anim_first, anim_second, anim_third, anim_fourth)
        .Replace(continer, Class)
        .Commit();
}

0 个答案:

没有答案