问题标签 [fragment-tab-host]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
4414 浏览

android - TabHost 和 FragmentTabHost 的区别

我有以下关于在 Android 中创建选项卡的教程。它可以在这里这里找到。

第一个使用 FragmentTabHost,第二个使用 TabHost 通过片段创建选项卡。我很难确定它的区别和对其性能的影响。

我试图搜索但未能找到答案。有人能帮我一下吗?谢谢。

0 投票
1 回答
1717 浏览

android - Android,FragmentTabHost - 如何去除蓝色?

我正在尝试在 android.support.v4.app.FragmentTabHost 上删除选项卡下方的蓝线和蓝色背景(选择选项卡时)。有人做过吗?

发送

0 投票
2 回答
4572 浏览

android - 如何设置 FragmentTabHost 选项卡文本颜色

如何设置FragmentTabHost标签文本颜色。我尝试了以下代码,但是没有用。


它给 NPE 说它找不到TextView.

0 投票
1 回答
458 浏览

android - 图标未显示在指示器的选项卡中

我按照本教程http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

但是我需要显示图像,所以我将一个 48x48 png 文件复制到 drawable-hdpi 中,并在 Initialize 主机中更改了选项卡行代码

我究竟做错了什么?图标不显示。

为了清晰起见,整个方法:

0 投票
1 回答
493 浏览

android - FragmentTabHost 和 ViewPager 重复片段

我有碎片问题。我发现 ViewPager 使用的片段实例与 FragmentTabHost 不同。

我没有找到如何在 ViewPager 中从 FragmentTabHost 添加片段,反之亦然。

如何让它们都使用相同的实例?

0 投票
1 回答
6979 浏览

android - 使用 FragmentTabHost 时如何设置 Tab Image?

我使用 android.support.v4.app.FragmentTabHost 编写了 Tab Navigation 的应用程序。我想将图像背景添加到我的选项卡。代码在这里:

0 投票
1 回答
757 浏览

android - 片段 Tabhost 内的嵌套片段在获取上下文和充气器时遇到问题

我正在使用actionbarsherlock一个tabhost片段,在我的一个选项卡中,我显示了一个名为的片段segmentedControlFrag,其中包括 4 个分段控制按钮(标记为“2hrs”、“8hrs”、“24hrs”和“1wk”)和一个占据其余部分的框架的屏幕。

When one of the buttons from the segmentedcontrolgroup is selected a asyncrequest grabs some important info , the frame is replaced with a new (visualFragmentFrag)fragment which includes the important info from the request in as a extra.

它工作得很好,我可以单击分段控制组中的每个按钮,它们每个都可以加载自己的变体visualTrendsFrag。我什至可以选择一个完全不同的选项卡并返回,它会加载到我上次选择的分段控件上。

只有当我在以下代码onCreateView中添加这行代码时,问题才会开始segmentedControlFrag

当我添加这行代码时,logcat 中的问题是与上下文相关的空指针错误。虽然如果我省略上面的行它确实有效,但我怀疑我管理片段的方式segmentedControlFrag也是错误的。

分段控制片段:

VisualTrendsFrag(嵌套在segmentedControlFrag框架内的片段:

编辑:我开始认为它不是一个上下文问题,因为它是一个 LayoutInflator 问题,这是我使用的导致“下面的 logcat 中的弹出窗口错误”的库: https ://github.com/lorensiuswlt/NewQuickAction 在此处输入图像描述

0 投票
0 回答
793 浏览

android - 按下主页按钮时应用程序崩溃

您好 frnds 正在开发一个加载 fragmentActivity 的应用程序。片段活动包含带有 4 个选项卡的 tabhost,每个选项卡加载片段。当我运行应用程序时,应用程序运行顺利,但是当我们按下主页按钮或任何其他应用程序运行时,我的应用程序崩溃......

这是我的原木猫

这是我的 tabActivity

这是我的 WelcomeFragment

0 投票
1 回答
4484 浏览

android - TabHost TabSpec setIndicator 中的标签和图标是否互斥?

在 Android 应用程序(最小 sdk 11,目标 sdk 18)上,扩展 Fragment 的类应该创建带有一个标签和一个图标的 TabHost 选项卡(TabSpec)。但...

据我所见,文档没有提到标签和图标是互斥的。

起初我以为标签有一个纯色的背景颜色来隐藏图标,但事实并非如此。事实上,当我设置 TabHost 背景时,我可以看到标签是透明的:

如何设置 TabSpec 背景,以便为每个选项卡显示标签和图标?

tab_host.xml

0 投票
1 回答
2211 浏览

android - List Fragment inside FragmentTabHost not updating when adapter changed

I have a FragmentActivity that contains a Fragment. this fragment contains a FragmentTabHost. The tab host contains three tabs that each one is a ListFragment.

The lists are configured with custom adapter that getting updates from the main FragmentActivity, and calling notifyDatasetChanged on update.

My problem is that it seems the ListFragment UI never updates the view when it's shown. If I change tabs - I can see the list updates, but I can't see the updates on real time when a list is shown on the screen.

That's the definition of the Fragment containing the FragmentTabHost:

Also included in that class is the ListFragment object:

The fragment layout "soi_container.xml" (simple layout containing FragmentTabHost):