如何在对话框中使用 TabHost?
我在 TabHost
中看到很多 Dialog
,但反之则不然。那么如何在 Dialog
内使用 TabHost
布局。如果可能的话,我也不想为每个 Tab
使用 Intent
,因为它对于我想做的事情来说似乎很混乱。
基本上我想启动一个用于菜单的Dialog
,并且我希望有一个TabHost
来浏览所有菜单选项。其中有很多 :) 现在我只是将 XML 布局设置为 Dialog
,但我对如何在该对话框中设置 TabHost
感到困惑。
I see plenty of Dialog
s inside a TabHost
but not the other way around. So how can I use a TabHost
layout inside of a Dialog
. I also don't want to have to use Intent
s for each Tab
if its possible because it just seems messy for what I want to do.
Basically I want to launch a Dialog
that I use for a menu and I would like to have a TabHost
to navigate through all the menu choices. There's a lot of them :) Right now I just set the XML layout to a Dialog
but I'm confused on how to set up a TabHost
inside that dialog.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想指出另一种方法,
而不是制作一个难以维护的复杂对话框,甚至可能使用为什么不在清单文件中的活动标记中使用以下代码以对话框模式打开单独的活动
这样您可以拥有所有的复杂性和复杂性。对话框中活动的功能。
我希望它有帮助..
I will like to point out an other approach,
Instead of making a complicated dialog that is difficult to maintain and maybe even use why not open a separate activity in the dialog mode by using the following code in the activity tag in the manifest file
This way you can hve all the complexities & capabilities of an activity in a dialog.
I hope it helps..
因此,我制作了一个 HostTab 布局,命名了每个线性/相对布局,并声明了我创建的每个选项卡,以使用 XML 文件中的线性/相对布局,它们的声明如下:
我仍然拥有所有按钮以及声明每个内部布局的其他视图,因此一切都按照我想要的方式工作:) 对我来说是的,哈哈,
但是感谢 @R.daneel.oliva 尝试加入:)
So I made a
HostTab
layout and named each Linear/Relative layout and declared each tab I created to use the Linear/Relative layout from the XML file where they were declared like so:I still have all the buttons and other views with each of the inner layouts declared so everything works just like I wanted :) yay for me lol
But thanks to @R.daneel.oliva for trying to jump in :)