我刚开始使用 Android,我想将选项卡添加到我现有的应用程序中。
现在我只有一个 Activity ,其布局在 XML 文件中定义。我现在想添加其他选项卡。
我查了一下发现http://developer.android.com/resources/tutorials/views/hello-tabwidget.html在 Android 开发者网站上;但是,它不使用 XML 来定义选项卡的布局。
那么,如何使用仅用于布局的 XML 文件轻松添加选项卡?
提前致谢。
最佳答案
I have looked it up and found http://developer.android.com/resources/tutorials/views/hello-tabwidget.html on the Android developer site; however, that doesn't use XML for defining the layout of the tabs.
是的,确实如此。参见步骤 #4。
更新
Google 重新组织了他们的文档并删除了本教程。您可以在 this sample project 的 TabWidget
中看到使用 XML 定义选项卡。 .
关于android - 使用 layout/main.xml 文件将选项卡添加到 Android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5207864/