[英]Set tab indicator height to match parent/tab height
Is there any way I can set the height of the tab indicator to the tab's height in android?有什么办法可以将标签指示器的高度设置为android中标签的高度吗?
<com.google.android.material.tabs.TabLayout
android:id="@+id/camera_mode_tabs"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="30dp"
app:tabIndicator="@drawable/mode_indicator"
app:tabGravity="center"
app:tabIndicatorHeight="30dp"
/>
I am able to do it by hardcoding the layout_height and tabIndicatorHeight to 30dp.我可以通过将 layout_height 和 tabIndicatorHeight 硬编码为 30dp 来实现。 But is it any better way to do it?
但是有没有更好的方法来做到这一点? Using wrap_content or something similar.
使用 wrap_content 或类似的东西。
迟到的答案,但你可以使用
app:tabIndicatorGravity="stretch"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.