ripple - Android design library TabLayout background issues -
when setup tabbackground attribute of "22.2.0 android design library" tablayout (android.support.design.widget.tablayout) 2 problems appear :
- the ripple effect in tabs lost
- the tab indicator disappears.
this occurs on both lollipop , kitkat devices.
without tabbackground settings, both ripple effect , tab indicator work background has default color different toobar, not conform material design guidelines.
please find below xml :
<android.support.design.widget.tablayout android:id="@+id/tablayout" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabmode="fixed" app:tabgravity="fill" app:tabbackground = "?attr/colorprimary" />
use android:background="?attr/colorprimary"
instead of app:tabbackground = "?attr/colorprimary"
.
if have dark primary color, may want change theme themeoverlay.appcompat.dark
. makes text , ripple color white.
full example:
<android.support.design.widget.tablayout android:id="@+id/tablayout" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabmode="fixed" app:tabgravity="fill" android:background="?attr/colorprimary" android:theme="@style/themeoverlay.appcompat.dark" />
Comments
Post a Comment