我有什么办法可以减少标题文本和图标之间的距离TabLayout
就像在 Google plus 中一样,图标和文本标题至少没有距离。我已经搜索过,但到目前为止还是找不到。
EDITED
这就是我设置图标和标题的方式:
tabLayout.getTabAt(3).setIcon(R.drawable.ic_more_horiz_white_24dp);
tabLayout.getTabAt(3).setText("More");
这是我的TabLayout
:
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/white"
app:tabIndicatorHeight="2dp"
app:tabTextAppearance="?android:attr/textAppearanceSmall"
/>
你可以尝试这个代码,它对我有用
for (i in 0 .. tabLayout.tabCount) {
val params = tabLayout.getTabAt(i)?.view?.getChildAt(0)?.layoutParams as LinearLayout.LayoutParams?
params?.bottomMargin = 0
tabLayout.getTabAt(i)?.view?.getChildAt(0)?.layoutParams = params
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)