不幸的是other question wasn't answered关于如何隐藏android.support.design.widget.TabLayout中的标签。 其他问题与TabHost,我不想改变我的代码。Tablayout中隐藏标签Android

我想隐藏标签“三”。

ca0c7c1aa5417f163628dff203cfb8be.png

片段:

viewPager = (ViewPager) rootView.findViewById(R.id.search_viewPager);

viewPager.addOnPageChangeListener(viewPagerListener);

viewPager.setAdapter(adapter);

tabLayout = (TabLayout) rootView.findViewById(R.id.search_tabs);

tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

tabLayout.setupWithViewPager(viewPager);

布局:

xmlns:app="http://schemas.android.com/apk/res-auto"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@color/white"

android:orientation="vertical">

android:id="@+id/search_tabs"

style="@style/TabLayoutStyle"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/white"

android:elevation="1dp" />

android:id="@+id/search_viewPager"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:fitsSystemWindows="true" />

+1

你可以将自己看着,并解释为什么该解决方案没有为你工作的其他问题?这是一个重复的问题,或者需要更多的解释来调整。 –

+1

请分享源码 –

+1

请不要在没有适用的代码 –

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐