TabLayout (Android Design Library) Text Color

Via XML attributes: <android.support.design.widget.TabLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” app:tabMode=”fixed” app:tabGravity=”fill” app:tabTextColor=”@color/your_unselected_text_color” app:tabSelectedTextColor=”@color/your_selected_text_color”/> Additionally, there are attributes like tabIndicatorColor or tabIndicatorHeight for further styling. In code: tabLayout.setTabTextColors( getResources().getColor(R.color.your_unselected_text_color), getResources().getColor(R.color.your_selected_text_color) ); Since this old way is deprecated as of API 23, the alternative is: tabLayout.setTabTextColors( ContextCompat.getColor(context, R.color.your_unselected_text_color), ContextCompat.getColor(context, R.color.your_selected_text_color) );

Error inflating class android.support.design.widget.NavigationView

Actually it is not the matter of the primarycolortext, upgrading or downgrading the dependencies.This problem will likely occur when the version of your appcompat library and design support library doesn’t match. Example of matching condition compile ‘com.android.support:appcompat-v7:23.1.1’ // appcompat library compile ‘com.android.support:design:23.1.1’ //design support library

android:textAllCaps=”false” not working for TabLayout design Support

UPDATE FOR DESIGN LIBRARY 23.2.0+ The original answer doesn’t work with design library 23.2.0 or later. Thanks for @fahmad6 pointed out in comment, in case someone missed that comment, I’ll put it here. You need to set both textAllCaps and android:textAllCaps to false to disable all capitalize setting. <style name=”MyCustomTextAppearance” parent=”TextAppearance.Design.Tab”> <item name=”textAllCaps”>false</item> <item name=”android:textAllCaps”>false</item> … Read more

Change the color of a checked menu item in a navigation drawer

Well you can achieve this using Color State Resource. If you notice inside your NavigationView you’re using app:itemIconTint=”@color/black” app:itemTextColor=”@color/primary_text” Here instead of using @color/black or @color/primary_test, use a Color State List Resource. For that, first create a new xml (e.g drawer_item.xml) inside color directory (which should be inside res directory.) If you don’t have a … Read more

Add views below toolbar in CoordinatorLayout

Take the attribute app:layout_behavior=”@string/appbar_scrolling_view_behavior” off the RecyclerView and put it on the FrameLayout that you are trying to show under the Toolbar. I’ve found that one important thing the scrolling view behavior does is to layout the component below the toolbar. Because the FrameLayout has a descendant that will scroll (RecyclerView), the CoordinatorLayout will get … Read more