开发者

tabwidget doesnt work mono c#

tab widget doesnt work. i got this (this is the next statement to execute when this threads returns from the current function)

        TabHost mTab = new TabHost(this);

        SetContentView(Resource.Layout.Main);

        Intent i = new Intent(this, typeof(Activity2));
        i.AddFlags(ActivityFlags.NewTask);
        mTab.AddTab(mTab.NewTabSpec("tag").SetIndicator("label").SetContent(i));

        Intent i2 = new Intent(this, typeof(Activity2));
        i2.AddFlags(ActivityFlags.NewTask);
        mTab.AddTab(mTab.NewTabSpec("tag2").SetIndicator("label2").SetContent(i2));

        mTab.CurrentTab = 0;
开发者_如何学编程


Your TabHost is not being set as the contentView. You need to add a tabHost object to your main.xml layout file then reference it like this:

TabHost mTab = (TabHost)findViewById(R.id.tabHost);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜