Android TabLayout tabPaddingTop and tabPaddingBottom not being removed
请参阅上述问题.
即使我将我的设计库更新为“23.2.0”,Tab布局也搞砸了.
下图是我的标签布局.
Xml部分: –
<android.support.design.widget.TabLayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabIndicatorColor="@android:color/white" app:tabIndicatorHeight="@dimen/dp2" app:tabMode="fixed" app:tabSelectedTextColor="@android:color/white" app:tabTextAppearance="@style/MyCustomTabTextAppearance" />
样式xml: –
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/color_156084</item> </style> <style name="MyCustomTabTextAppearance" parent="TextAppearance.Design.Tab"> <item name="android:textSize">@dimen/sp14</item> <item name="android:textColor">@android:color/white</item> <item name="textAllCaps">false</item> </style>
我已将padding设置为-1dp,甚至将tabGravity填充,但没有任何工作.
此代码曾用于早期版本,但现在如果我降级它,我在TintManager上得到一个没有类def找到错误.
解决方法
设置不同的值或布局参数不起作用,所以我得到的唯一解决方案是在将选项卡添加到选项卡布局后添加以下内容,
final ViewGroup test = (ViewGroup)(tabs.getChildAt(0));//tabs is your Tablayout int tabLen = test.getChildCount(); for (int i = 0; i < tabLen; i++) { View v = test.getChildAt(i); v.setPadding(0,0); }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。