作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
提前致谢..
当我在 android 应用程序中创建自定义选项卡时,主屏幕上没有显示任何选项卡
谁能告诉我如何解决这个问题?
最佳答案
你的意思是你想为你的应用程序创建自定义选项卡。好的,现在你有两个类,即 homemyclass.java 和 myclass.java。首先,您在 homemyclass.java 中声明了两行流
private Intent mytab;
private static final String TAB_MYCLASS = "myclass";
然后你在 homemyclass.java 的 onCreate() 函数中写入流水线
mytab = new Intent(this, myclass.class);
addTab(TAB_MYCLASS, getString(R.string."label for tab"), R.drawable."icon for tab display when
tab is selected", R.drawable."icon for tab display when tab is not selected", mytab);
只需将 addTab() 添加到 homemyclass.java 中
private void addTab(String tag, String label, int icon, int ficon, Intent content) {
TabHost tabHost = getTabHost();
TabSpec tabspecDialer = tabHost.newTabSpec(tag).setContent(content);
//boolean fails = true;
tabspecDialer.setIndicator(label, getResources().getDrawable(icon));
tabHost.addTab(tabspecDialer);
}
还需要通过homemyclass.java和myclass.java修改androidManifest.xml
关于android - 如何在 Android 应用程序中创建自定义选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6275928/
我是一名优秀的程序员,十分优秀!