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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -