불행히도 other question wasn't answered에 대해 어떻게 탭을 숨길 지 android.support.design.widget.TabLayout
에 있습니다. 다른 질문은 TabHost
으로되어 있습니다. 코드를 변경하고 싶지 않습니다.Tablayout 안드로이드 탭 숨기기
탭 "3"을 숨기고 싶습니다.
조각 :
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);
레이아웃 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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.support.design.widget.TabLayout
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.support.v4.view.ViewPager
android:id="@+id/search_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" />
</LinearLayout>
당신이 그 해결책이 당신을 위해 작동하지 않았다 이유를 설명 보았다 다른 질문을 연결할 수 있습니다 공부 몇 가지 아이디어를 가질 수있다? 이 질문은 중복 된 질문이거나 더 많은 설명과 함께 조정해야합니다. – AdamMc331
제발, 소스 코드를 공유하십시오 – ddb
해당 코드 없이는 아무것도 제안 할 수 없습니다 – BR89