我正在使用SmartTabLayout。我想使用像这样的指标(像一个圆圈)。我无法在xml中找到一些合适的参数。 有什么想法吗?
想要这个:
我有这个:
XML代码:
<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
app:stl_clickable="true"
app:stl_defaultTabBackground="?attr/selectableItemBackground"
app:stl_defaultTabTextAllCaps="true"
app:stl_defaultTabTextColor="#FC000000"
app:stl_defaultTabTextHorizontalPadding="16dp"
app:stl_defaultTabTextMinWidth="0dp"
app:stl_defaultTabTextSize="12sp"
app:stl_distributeEvenly="false"
app:stl_dividerColor="#4D000000"
app:stl_dividerThickness="1dp"
app:stl_drawDecorationAfterTab="false"
app:stl_indicatorAlwaysInCenter="false"
app:stl_indicatorColor="#40C4FF"
app:stl_indicatorCornerRadius="2dp"
app:stl_indicatorGravity="bottom"
app:stl_indicatorInFront="false"
app:stl_indicatorInterpolation="smart"
app:stl_indicatorThickness="4dp"
app:stl_indicatorWidth="auto"
app:stl_indicatorWithoutPadding="false"
app:stl_overlineColor="#4D000000"
app:stl_overlineThickness="0dp"
app:stl_titleOffset="24dp"
app:stl_underlineColor="#4D000000"
app:stl_underlineThickness="1dp" />
答案 0 :(得分:2)
仔细阅读演示中的一些代码。我遇到了“Trick 1”布局,这可能就是答案。测试一下,如果它不起作用,请回复我。如果它不起作用,我将拉出项目并测试它。
<com.ogaclejapan.smarttablayout.SmartTabLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@id/viewpagertab"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
android:clipToPadding="false"
android:paddingLeft="4dp"
android:paddingRight="4dp"
app:stl_defaultTabTextColor="@color/white"
app:stl_defaultTabTextHorizontalPadding="18dp"
app:stl_dividerColor="@color/transparent"
app:stl_dividerThickness="0dp"
app:stl_indicatorColor="@color/black_20"
app:stl_indicatorCornerRadius="18dp"
app:stl_indicatorInterpolation="smart"
app:stl_indicatorGravity="center"
app:stl_indicatorThickness="36dp"
app:stl_underlineColor="@color/transparent"
app:stl_underlineThickness="0dp"
/>
答案 1 :(得分:-1)
使用以下代码:-
<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/viewpagertab"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginTop="@dimen/_6sdp"
android:layout_marginEnd="@dimen/_15sdp"
android:layout_marginBottom="@dimen/_5sdp"
android:clipToPadding="true"
app:stl_customTabTextLayoutId="@layout/item_custom_font_textview"
app:stl_customTabTextViewId="@+id/tv_custom_font_textview"
app:stl_defaultTabBackground="@android:color/transparent"
app:stl_defaultTabTextAllCaps="false"
app:stl_defaultTabTextHorizontalPadding="@dimen/_5sdp"
app:stl_defaultTabTextMinWidth="0dp"
app:stl_distributeEvenly="true"
app:stl_dividerThickness="0dp"
app:stl_indicatorColor="@color/btn_color"
app:stl_indicatorCornerRadius="18dp"
app:stl_indicatorGravity="center"
app:stl_indicatorInterpolation="linear"
app:stl_indicatorThickness="@dimen/_25sdp"
app:stl_indicatorWidth="auto"
app:stl_underlineThickness="0dp" />