2017-11-28 12 views
0

내 타블 레이 아웃 높이는 랩 콘텐츠입니다. 하지만 작동하지 않습니다. 여기에 스크린 샷을 붙여 넣습니다. 휴대 전화에서는 작동하지만 탭에서는 작동하지 않습니다.타블렛에서 타블 레이 아웃 높이가 작동하지 않습니다.

enter image description here

이 문제는 폭하지만 태그 응용 프로그램과 함께도했다 : tabMaxWidth는 = "0dp"나를 도왔다. 어떻게 이것을 극복 할 수 있습니까? 다음은 레이아웃 코드입니다.

<android.support.design.widget.TabLayout 
    android:id="@+id/tablayout_add" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:tabMaxWidth="0dp" 
    android:minHeight="0dp" 
    android:layout_gravity="bottom" 
    android:layout_below="@+id/relativeLayout" 
    app:tabGravity="fill" 
    app:tabBackground="@drawable/tab_color_selector" 
    app:tabIndicatorColor="@color/sea_green" 
    app:tabIndicatorHeight="2dp" 
    app:tabMode="fixed" 
    android:clickable="false" 
/> 
+0

감사합니다. @halfer하지만이 링크의 답변을 따르면 완벽하게 작동합니다. https://stackoverflow.com/questions/30843775/tab-not-taking-full-width-on-tablet-device-using-android-support-design-widget – Pousti

+1

방금 ​​수정했습니다. – Pousti

답변

0

문제는 tablayout의 부모와 관련이 있습니다. tablayout는 ok이었다. 다음은 상위 항목의 코드입니다.

<RelativeLayout 
     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/default_app_white" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     > 
     <android.support.design.widget.TabLayout 
      android:id="@+id/tablayout_add" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabMaxWidth="0dp" 
      android:minHeight="0dp" 
      android:layout_gravity="bottom" 
      android:layout_below="@+id/relativeLayout" 
      app:tabGravity="fill" 
      app:tabBackground="@drawable/tab_color_selector" 
      app:tabIndicatorColor="@color/sea_green" 
      app:tabIndicatorHeight="2dp" 
      app:tabMode="fixed" 
      android:clickable="false"/> 
</RelativeLayout> 
0

소재 디자인 지침 탭 레이아웃 높이는 48dp입니다. 치수 파일에이 값을 입력하고 치수 키를 높이로 사용하십시오.

탭 레이아웃 탭 텍스트 크기는 14sp입니다.

+0

wrapcontet가 작동하지 않습니까? 너비에 따라 내용을 감싸지 않을 것인가? – Pousti

+0

답변을 자세히 작성하십시오. xml에서이 값을 어떻게 사용합니까? tabl에 값을 사용하면 모바일과 같은 다른 장치의 레이아웃에는 영향을 미치지 않을까요? – Pousti