gpt4 book ai didi

android - 当我升级 android.support.v4 时 Tabhost 内容不显示

转载 作者:太空宇宙 更新时间:2023-11-03 10:38:01 29 4
gpt4 key购买 nike

我正在使用 TabHost,在我更新支持库之前它工作正常。当我更新 jar 时,标签内容不可见,只显示标签。

我正在使用 FragmentActivity

这是 XML:

<android.support.v4.app.FragmentTabHost
android:id="@+id/tab_host"
style="@style/FillParentWrapContent"
android:layout_below="@id/view_location_card"
android:layout_marginLeft="@dimen/view_margin"
android:layout_marginRight="@dimen/view_margin" >

<FrameLayout
android:id="@android:id/tabcontent"
style="@style/FillParentWrapContent" />

<FrameLayout
android:id="@+id/tab_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingTop="@dimen/view_margin_extra_large" />
</android.support.v4.app.FragmentTabHost>

代码 fragment :

FragmentTabHost tabHost = (FragmentTabHost) findViewById(R.id.tab_host);
tabHost.setup(this, getSupportFragmentManager(), R.id.tab_content);
Bundle bundle = new Bundle();
bundle.putInt(CommonConstants.TAB_ID, tabTitleId);
tabHost.addTab(tabHost.newTabSpec("Title").setIndicator(tabView), Fragment.class, bundle);

请帮我解决这个问题。我需要更新库,因为我正在使用 Marshmallow GPS 许可等新功能。

我认为这个问题是因为标签占满了宽度,所以我们的 ListView 没有空间来显示内容。

最佳答案

尝试插入一个 tabwidget,如:

<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />

<FrameLayout
android:id="@+id/tab_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingTop="@dimen/view_margin_extra_large" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>

关于android - 当我升级 android.support.v4 时 Tabhost 内容不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39660636/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com