TextSwitcher和ImageSwitcher在同一个类中有问题。 XAMARIN

时间:2016-09-03 14:22:28

标签: c# xamarin xamarin.android

我努力寻找解决方案,但无法找到解决方案。 这就是我希望实现的目标, Can you have a textSwitcher and imageSwitcher in the same class?

但我无法将其转换为C#代码。我对它给出的错误一无所知。

我知道我需要创建一个内部类。但我对如何感到困惑。

谢谢!

1 个答案:

答案 0 :(得分:0)

使用您提供的链接,您的内部类在Xamarin

中看起来像这样
public class TextSwitcherFactory : Java.Lang.Object, ViewSwitcher.IViewFactory
{
    public View MakeView()
    {
        TextView t = new TextView(Latest.this);
        t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
        t.setTextSize(36);
        return t;
    }
}