由于该站点上的其他帖子,我设法使标签布局示例与三个标签,专辑,歌曲和艺术家一起工作。我只是想通过执行以下步骤,按照相同的步骤添加一个名为歌词的新标签...
添加名为LyricsActivity .....的新活动/类
公共类LyricsActivity扩展Activity
{
公共无效onCreate(捆绑保存的InstanceState)
{
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
textview.setText("This is the Lyrics tab");
setContentView(textview);
}
}
然后将以下内容添加到AndroidManifest文件中。
发生的情况是新的“歌词”选项卡正确显示,但没有显示“这是歌词”选项卡,而是显示“这是歌曲”选项卡。有任何想法吗?
谢谢
标清
最佳答案
我认为您可能忘记了为标签分配正确的意图。
// Do the same for the other tabs
intent = new Intent().setClass(this, AlbumsActivity.class);
spec = tabHost.newTabSpec("albums").setIndicator("Albums",
res.getDrawable(R.drawable.ic_tab_albums))
.setContent(intent);
mTabHost.addTab(spec);
其中AlbumsActivity将是您的LyricsActivity,依此类推。
Guide
关于android - 以下开发者网站上的标签布局android示例并尝试添加第四个标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2377095/