onClick method not working properly after NestedScrollView scrolled

I found solution for same problem on this thread :The item inside RecyclerView can’t be clicked right after scrolling You can fix your code by adding layout_behavior to your AppBarLayout.You can find code here Fixed AppBarLayout.Behavior .Just add this class tou your project and fix your code : <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” app:layout_behavior=”yourPackageName.FixAppBarLayoutBehavior” android:layout_height=”wrap_content”>

CoordinatorLayout using the ViewPager’s RecyclerView

Chris Banes has posted a sample on Github which shows exactly what you want to do. Here is the xml file that defines how one can indirectly attach a coordinator layout to the viewpager’s fragments. <android.support.design.widget.CoordinatorLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/main_content” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.design.widget.AppBarLayout android:id=”@+id/appbar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light” app:layout_scrollFlags=”scroll|enterAlways” /> <android.support.design.widget.TabLayout … Read more

Android CollapsingToolbarLayout collapse Listener

I share the full implementation, based on @Frodio Beggins and @Nifhel code: public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener { public enum State { EXPANDED, COLLAPSED, IDLE } private State mCurrentState = State.IDLE; @Override public final void onOffsetChanged(AppBarLayout appBarLayout, int i) { if (i == 0) { if (mCurrentState != State.EXPANDED) { onStateChanged(appBarLayout, State.EXPANDED); } mCurrentState … Read more

Change the font of tab text in android design support TabLayout

If you are using TabLayout and you want to change the font you have to add a new for loop to the previous solution like this: private void changeTabsFont() { ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0); int tabsCount = vg.getChildCount(); for (int j = 0; j < tabsCount; j++) { ViewGroup vgTab = (ViewGroup) vg.getChildAt(j); int … Read more

Overlap scrolling view with AppBarLayout

In fact, overlaying the scrolling view with the AppBarLayout is an included feature of the Android Design Support Library: you can use the app:behavior_overlapTop attribute on your NestedScrollView (or any View using ScrollingViewBehavior) to set the overlap amount: <android.support.v4.widget.NestedScrollView android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_behavior=”@string/appbar_scrolling_view_behavior” app:behavior_overlapTop=”64dp”> Note that app:behavior_overlapTop only works on views that have the app:layout_behavior=”@string/appbar_scrolling_view_behavior” as … Read more

Error when using any Android Design Support Library Elements

In addition to Emmanuel’s answer you could be facing the following problem. It seems like the design library components need a style which is based on an AppCompat Theme. So try to use “Theme.AppCompat.[…]” as a parent in your style.xml. Example: <!– Base application theme. –> <style name=”AppTheme” parent=”Base.AppTheme”> <!– Customize your theme here. –> … Read more

TabLayout Tab Title text in Lower Case

If you add the following line to your TabLayout it should work: app:tabTextAppearance=”@android:style/TextAppearance.Widget.TabWidget” Use it like this: <android.support.design.widget.TabLayout android:id=”@+id/tabLayout” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:tabIndicatorColor=”@android:color/white” app:tabIndicatorHeight=”2dp” app:tabTextAppearance=”@android:style/TextAppearance.Widget.TabWidget” app:tabSelectedTextColor=”@android:color/white” app:tabTextColor=”@android:color/white” />

Don’t collapse Toolbar when RecyclerView fits the screen

Final Solution (thanks MichaƂ Z.) Methods to turn off/on Toolbar scrolling: public void turnOffToolbarScrolling() { Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar); AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appbar_layout); //turn off scrolling AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); toolbarLayoutParams.setScrollFlags(0); mToolbar.setLayoutParams(toolbarLayoutParams); CoordinatorLayout.LayoutParams appBarLayoutParams = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams(); appBarLayoutParams.setBehavior(null); appBarLayout.setLayoutParams(appBarLayoutParams); } public void turnOnToolbarScrolling() { Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar); AppBarLayout appBarLayout = … Read more

How to set custom typeface to items in NavigationView?

just add following class file to your project. import android.graphics.Paint; import android.graphics.Typeface; import android.text.TextPaint; import android.text.style.TypefaceSpan; public class CustomTypefaceSpan extends TypefaceSpan { private final Typeface newType; public CustomTypefaceSpan(String family, Typeface type) { super(family); newType = type; } @Override public void updateDrawState(TextPaint ds) { applyCustomTypeFace(ds, newType); } @Override public void updateMeasureState(TextPaint paint) { applyCustomTypeFace(paint, newType); } … Read more