开发者

tabwidget doesnt work mono c#

开发者 https://www.devze.com 2023-03-14 07:45 出处:网络
tab widget doesnt work. i got this (this is the next statement to execute when this threads returns from the current function)

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

精彩评论

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