- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个选项卡 UI,但我不想在 tabHosts 上放置任何图像,因此我决定使用 setIndicator(CharSequence 标签)而不是使用 setIndicator(CharSequence 标签,Drawable 图标)。然后创建没有图像的 tabHost,但它的高度更小并且仅包含 CharSequence,它与带有图像的常规 tabHost 具有相同的高度。顶部有一个空闲空间,通常位于图像所在的位置,文本位于该空白空间下方。无论如何要删除为图像保留的可用空间,或者翻转两者,以便文本位于顶部,之后我可以将 layout_height 设置为 15dp 例如。主要布局的 .xml 代码是
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
最佳答案
您可以将@null 设置为背景,并设置负边距以删除可用空间。
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="-2dp"
android:layout_marginRight="-2dp" />
关于Android:TabHost.TabSpec setIndicator(CharSequence 标签),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4459996/
我有 3 个标签包含不同的内容。他们从 Internet 加载内容。我使用 3 个 AsyncTasks 来完成它。一开始,3个tab显示3个ProgressBar。我希望每次完成一项任务时,它都会更
我的 Activity 布局之一中有一个 TabHost,有 4 个 TabSpec。我已将每个 TabSpec 的内容设置为不同的 LinearLayout,但只有第一个 TabSpec 实际显示
我有一个 fragment ,在其中,我声明了一个 FragmentTabHost。 public class ComFragment extends Fragment{ ... pr
我在 Fragment 中使用 TabHost 来创建标签。我遇到的问题是 TabSpec 的 setContent() .我需要设置它,以便它在 下嵌套另一个 fragment . 我是否使用 g
在 Android 应用程序(最小 sdk 11,目标 sdk 18)上,扩展 Fragment 的类应该创建带有一个标签和一个图标的 TabHost 选项卡 (TabSpec)。但是…… TabSp
我正在使用 TabHost 和 TabSpec。我想在单击 TabSpec 时执行一些操作(如 onClick)。有没有人试过这个我可以用“home.setIndicator(“Home”).....
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Tab
我正在尝试创建一个选项卡 UI,但我不想在 tabHosts 上放置任何图像,因此我决定使用 setIndicator(CharSequence 标签)而不是使用 setIndicator(CharS
我有一个使用选项卡的 android Activity 。 public class UnitActivity extends TabActivity { @Override public v
我正在尝试将我的 TabHost 中的选项卡内容设置为 RelativeLayout(在我的一个 XML 文件的顶层定义)。 我已经尝试通过使用 R.layout.lobby_tab 和 R.id.l
嗨 guyzz 我有 TabActivity 如下简单的代码 public class TabhostActivity extends Activity{ TabHost host;
我正在一个应用程序中实现选项卡式布局,其中垂直屏幕空间至关重要,因此我调整了 XML 布局中选项卡的高度。这些选项卡没有图标可绘制资源,它们有基本的文本标签。以编程方式设置 TabSpec 时,我正在
我有包含 TabHost 的主要 Activity 。 在 TabHost 中,我有几个 TabSpec,它们使用 Intent 作为选项卡的内容。 在我的代码中的某些点,我需要从 TabHost 中
我关注了 Android tutorial for TabLayout ,我现在正尝试通过使用布局以及每个选项卡的 Activity 来修改它。不幸的是,在将 TabSpec 添加到我的 TabHos
我需要为 TabHost 的指标使用我的自定义 View 。使用 Android API 级别 >=4 没问题,但在 Android API 级别 <4 中,此方法未实现。有什么建议吗? 我正在考虑实
我是一名优秀的程序员,十分优秀!