android - TabLayout Indicator slides really slow on Tab selection -
i'm using tablayout
2 nested fragments , have noticed when user clicks other tab, while content changes immediately, indicator move first tab second takes literally 3-4 seconds.
i have same behavior in device have far tried app (not genymotion). nexus 4 , nexus 5x of testing devices.
the layout :
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:emvideoview="http://schemas.android.com/apk/res-auto" android:background="@color/white" android:clickable="true" android:layout_width="match_parent" android:layout_height="match_parent"> <com.devbrackets.android.exomedia.emvideoview android:id="@+id/video_play_activity_video_view" android:layout_width="match_parent" android:layout_height="360dp" emvideoview:defaultcontrolsenabled="true"/> <android.support.design.widget.tablayout android:id="@+id/nested_tabs" android:layout_below="@+id/video_play_activity_video_view" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:tabmode="fixed" app:tabgravity="fill"/> <framelayout android:id="@+id/fl_nested_tabs_container" android:layout_below="@+id/nested_tabs" android:layout_width="match_parent" android:layout_height="wrap_content"/>
and code change tabs :
@override public void ontabselected(tablayout.tab tab) { if (iscommentsfragmentselected) { iscommentsfragmentselected = false; getchildfragmentmanager() .begintransaction() .replace(r.id.fl_nested_tabs_container, pollsfragment.newinstance()) .commit(); } else { iscommentsfragmentselected = true; getchildfragmentmanager() .begintransaction() .replace(r.id.fl_nested_tabs_container, commentsfragment.newinstance()) .commit(); } }
i using nested fragments in 3 tab layout viewpager. setting offscreen page limit solved slow loading problem me.
viewpager.setoffscreenpagelimit(2);
i have same problem, did you make it ?
ReplyDelete