我正在使用SmartTabLayout,我想在单击或选择选项卡时禁用波纹效果和一些灰色方形背景。
我将此代码添加到我的 xml 但仍然不起作用:
app:tabBackground="?attr/transparentColor"
android:background="?attr/transparentColor"
我尝试了这个解决方案,但也没有成功。
有什么想法吗? 这是我的 xml:
<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/viewpagertab"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
app:tabBackground="@android:color/transparent"
android:background="@android:color/transparent"
app:stl_indicatorAlwaysInCenter="false"
app:stl_indicatorWithoutPadding="false"
app:stl_indicatorInFront="false"
app:stl_indicatorInterpolation="smart"
app:stl_indicatorGravity="bottom"
app:stl_indicatorColor="#40C4FF"
app:stl_indicatorThickness="2dp"
app:stl_indicatorWidth="auto"
app:stl_underlineColor="@android:color/transparent"
app:stl_underlineThickness="1dp"
app:stl_dividerColor="@android:color/transparent"
app:stl_dividerThickness="1dp"
app:stl_indicatorCornerRadius="2dp"
app:stl_defaultTabTextAllCaps="true"
app:stl_defaultTabTextColor="#FC000000"
app:stl_defaultTabTextSize="14sp"
app:stl_defaultTabTextHorizontalPadding="16dp"
app:stl_defaultTabTextMinWidth="0dp"
app:stl_distributeEvenly="false"
app:stl_clickable="true"
app:stl_titleOffset="24dp"
app:stl_drawDecorationAfterTab="false" />
你尝试过android:clickable="true"吗?
//Remove Ripple
for(int i=0;i<tabIcon.tabs().length;i++)
{
View tabs= viewPagerTab.getTabAt(i);
tabs.setBackground(null);
}