AlertDialog 中的 Android 选项卡 [英] Android tabs in AlertDialog

查看:16
本文介绍了AlertDialog 中的 Android 选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 AlertDialog 中有标签吗?

Can I have tabs in AlertDialog?

我浏览了很多在线教程,他们通常将意图从一个活动转移到另一个活动的选项卡中.但是,警报对话框都在一个活动中.

I've gone through a lot of online tutorials and they usually place the intent from one activity to another in the tabs. However the alert dialog is all within a single activity.

我想在一个警报对话框中有两个选项卡.

I want to have two tabs in one alert dialog.

推荐答案

我可以在 AlertDialog 中有标签吗?

Can I have tabs in AlertDialog?

大概您可以在 AlertDialog 中使用 TabHostTabWidget,使用选项卡的视图.此示例显示活动中的视图作为选项卡:https://github.com/commonsguy/cw-omnibus/tree/master/WidgetCatalog/Tab 在您的情况下,您将使用相同类型的布局,但使用 LayoutInflater 创建 View 然后与 AlertDialog.Builder 一起使用来创建对话框.

Presumably you can use TabHost and TabWidget in an AlertDialog, using views for the tabs. This sample shows views-as-tabs in an activity: https://github.com/commonsguy/cw-omnibus/tree/master/WidgetCatalog/Tab In your case, you would use the same sort of layout, but use LayoutInflater to create the View that you then use with AlertDialog.Builder to create the dialog.

我浏览了很多在线教程,他们通常将意图从一个活动到另一个活动放在选项卡中.

I've gone through a lot of online tutorials and they usually place the intent from one activity to another in the tabs.

恕我直言,这些教程现在已经过时了.将活动嵌入选项卡的整个技术已被弃用.

Those tutorials are obsolete now IMHO. The whole technique of embedding activities in tabs has been deprecated.

这篇关于AlertDialog 中的 Android 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆