0

(내 영어로는 죄송합니다) 내가 한 것은 viewPager 내부의 viewPager이고 Padding으로 각 탭에 이미지 및 텍스트를 설정하려고합니다. 이런 식으로하고 싶습니다. - Mock up design높이 및 여백을 tablayout의 탭에있는 이미지 및 텍스트로 설정하십시오.

그러나 지금까지는 탭 & 여백에 이미지를 추가했습니다. 하지만 탭 사이의 여백이 왜 작동하지 않는지 모르겠습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_main" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
tools:context="com.example.ansh.customizingtab.MainActivity"> 


    <android.support.design.widget.TabLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:id="@+id/tabLayout" 
     app:tabMode="scrollable" 
     app:tabGravity="fill" 
     android:layout_margin="10dp" 
     app:tabPaddingStart="8dp" 
     app:tabPaddingEnd="8dp" 
     app:tabBackground="@drawable/background_tab"> 
    </android.support.design.widget.TabLayout> 


<com.example.ansh.customizingtab.CustomViewPager 
    android:id="@+id/viewpager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/white" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

이 결과 - - Result image

+0

** CustomViewPager **에 대한 코드를 표시하십시오. 너비에 "wrap_content"를 사용하고 높이에 대해 wrap_content를 실행하십시오. –

+0

현재 CustomViewPager에는 아무 것도 없습니다. 방금 스 와이프 효과를 사용하지 않도록 설정했습니다. @GeetChoubey –

답변

0

체크 아웃 여기 https://stackoverflow.com/a/36552313/6580534 대답 여기 내 XML 코드입니다. 잘하면 이것이 당신이 찾고있는 것입니다.

+0

건배!! 이미이 링크를 보았지만 집중하지 않았습니다. 내 잘못이야... –