我在TabLayout上的标签占据了屏幕的中心,即使在按照
Adam John’s answer添加tabMaxWidth =“0dp”之后也没有填满整个宽度
这是我希望通过制表符扩展到填充屏幕,如下所示:
但我得到的是:
我的XML看起来像这样:
<android.support.design.widget.TabLayout android:id="@+id/tl_contact_type" style="@style/tabWidgetLayout" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMaxWidth="0dp" app:tabGravity="fill" app:tabMode="fixed"/>
tabWidgetLayout的style.xml
<style name="tabWidgetLayout" parent="Widget.Design.TabLayout"> <item name="tabIndicatorColor">@color/colorTealAccent</item> <item name="tabIndicatorHeight">@dimen/default_corner_radius_medium</item> <item name="tabBackground">?attr/selectableItemBackground</item> <item name="android:background">@color/colorBrandPrimaryDark</item> <item name="tabSelectedTextColor">@color/color_tab_selected_text</item> <item name="tabTextAppearance">@style/tabWidgetLayoutTextAppearance</item> </style>
任何帮助解决这个问题非常感谢.
解决方法
请尝试下面的代码段
<android.support.design.widget.TabLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMaxWidth="0dp" app:tabGravity="fill" app:tabMode="fixed" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。