Я хочу использовать CollapsingToolbarLayout с RecyclerView и панелью инструментов.
Поэтому, когда я прокручиваю вверх / вниз, он запаздывает,
не может правильно прокручивать его очень медленно и медленно. пожалуйста, дайте мне правильное решение для этого. когда я буду прокручивать, это будет сильно отставать. в чем проблема об этом. Я проверил различные методы, но не смог достичь этого. Есть ли хороший способ, который может решить эту проблему?
здесь xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/main_content"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="400dp"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_collapseMode="parallax" >
<ImageView
android:id="@+id/ivItem"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<include
android:id="@+id/toolbar_header_view"
layout="@layout/widget_header_view_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include
android:id="@+id/float_header_view"
layout="@layout/widget_header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/scrollView"
app:layout_behavior="com.simplysufixprs.net.custom.scrolling_activity.WhatsAppHeaderBehavior" />
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_clr"
android:layout_marginTop="@dimen/activity_margin_normal"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/content_main" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
content main:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_clr"
android:orientation="vertical">
<com.simplysufixprs.net.custom.views.NonScrollExpandableListView
android:id="@+id/lvMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:groupIndicator="@null"
android:listSelector="@android:color/transparent"
android:scrollbars="none"
android:visibility="gone" />
<!-- your choice decs-->
<LinearLayout
android:visibility="gone"
android:id="@+id/llYourChoice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_clr"
android:orientation="vertical"
android:padding="16dp">
<com.simplysufixprs.net.custom.views.CTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="Desription"
android:textColor="#bc3123"
android:textSize="@dimen/txt_medium"
app:fontName="@string/avennir_next" />
<com.simplysufixprs.net.custom.views.CTextView
android:id="@+id/tvYourChoice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:textColor="@color/black"
android:textSize="@dimen/txt_normal"
app:fontName="@string/avennir_next" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:background="@color/bg_clr"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rvOptions"
android:background="@color/bg_clr"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- inflate recycler view for option innerOptionItems-->
<LinearLayout
android:id="@+id/llOptionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#efefef"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="16dp">
</LinearLayout>
<com.simplysufixprs.net.custom.views.CTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="Quantity"
android:textColor="#bc3123"
android:textSize="@dimen/txt_medium"
app:fontName="@string/avennir_next" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llQuanitySelection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlQuantitySelection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@drawable/rounded_rect_cart_quantity"
android:padding="10dp">
<RelativeLayout
android:id="@+id/rlMinus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@drawable/button_radius_with_solid_color">
<com.simplysufixprs.net.custom.views.CTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="+"
android:textColor="@color/white"
android:textSize="@dimen/txt_large"
android:visibility="invisible"
app:fontName="@string/avennir_next" />
<com.simplysufixprs.net.custom.views.CTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="10dp"
android:text="-"
android:textColor="@color/white"
android:textSize="@dimen/txt_large"
app:fontName="@string/avennir_next" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlPlus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/button_radius_with_solid_color">
<com.simplysufixprs.net.custom.views.CTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="+"
android:textColor="@color/white"
android:textSize="@dimen/txt_large"
app:fontName="@string/avennir_next" />
</RelativeLayout>
<com.simplysufixprs.net.custom.views.CTextView
android:id="@+id/tvQty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="10dp"
android:text="1"
android:textColor="@color/black"
android:textSize="@dimen/txt_large"
app:fontName="@string/avennir_next" />
</RelativeLayout>
<com.simplysufixprs.net.custom.views.CTextView
android:id="@+id/tvAddToCart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/button_radius_with_solid_color"
android:gravity="center"
android:padding="16dp"
android:text="Add to Cart"
android:textColor="@color/white"
android:textSize="@dimen/txt_large"
app:fontName="@string/avennir_next" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>