When a fragment opens, when scrolling up and down everything is very slow. What could be the reason?

<?xml version="1.0" encoding="utf-8"?> 

 <android.support.design.widget.AppBarLayout android:id="@+id/main.appbar" android:layout_width="match_parent" android:layout_height="400dp" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsBar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginEnd="64dp" app:expandedTitleMarginStart="48dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <ImageView android:id="@+id/img_artist" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:scaleType="centerCrop" android:src="@drawable/monro" app:layout_collapseMode="parallax" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:text="Имя" android:paddingLeft="10dp" android:layout_height="wrap_content" /> <EditText android:layout_width="wrap_content" android:text="Алена" android:paddingLeft="10dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/albums_artist_info" android:layout_width="wrap_content" android:textSize="17dp" android:paddingLeft="10dp" android:text="Фамилия" android:layout_height="wrap_content" /> <EditText android:id="@+id/tracks_artist_info" android:layout_width="wrap_content" android:textSize="17dp" android:text="АБДУЛЫХОВА-ОГЛЫ" android:padding="10dp" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dp" android:text="EMAIL" /> <EditText android:layout_width="wrap_content" android:paddingLeft="10dp" android:text="ALENKKKA87@GMAIL.COM" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:text="НОМЕР ТЕЛЕФОНА" android:layout_height="wrap_content" /> <EditText android:layout_width="wrap_content" android:text="+7 (932) 233-45-42" android:layout_height="wrap_content" /> <Switch android:id="@+id/monitored_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="32dip" android:text="Заморозить участие" /> <TextView android:layout_width="wrap_content" android:text="ВЫ МОЖЕТЕ ПРИОСТАНОВИТЬ УЧАСТИЕ  В ПРОЕКТЕ. НОВАЯ ПРОГРАММА НЕ БУДЕТ ОТПРАВЛЕНА, ОТЧЕТ НЕ НУЖНО ЗАПОЛНЯТЬ." android:layout_height="wrap_content" /> <include layout="@layout/notification_card_view_profile"></include> </LinearLayout> </android.support.v4.widget.NestedScrollView> 

 <?xml version="1.0" encoding="utf-8"?> 

 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_centerInParent="true" android:layout_width="wrap_content" android:orientation="horizontal" android:layout_height="wrap_content"> <TextView android:layout_width="match_parent" android:text="Настройка уведомлений" android:layout_weight="1" android:layout_height="wrap_content" /> <ImageButton android:layout_width="match_parent" android:layout_weight="3" android:src="@drawable/notification" android:layout_height="match_parent" /> </LinearLayout> </RelativeLayout> </android.support.v7.widget.CardView> 
  • According to current information, we can only say that the reason is in the fragment with the paralax element - ermak0ff
  • @ ermak0ff I apologize, I forgot to add the code - Martinez Toni
  • @ ermak0ff corrected - Martinez Toni
  • Perhaps just a picture in AppBare heavy? Try replacing it with a small one - YuriySPb
  • @ YuriySPb did not help - Martinez Toni

1 answer 1

When another scrolling view is found in NestedScrollView , then it needs to disable nested scrolling with the setNestedScrollingEnabled(false) method setNestedScrollingEnabled(false) . In your case, this is paralax , which apparently is inside the includ.

  • CardVIew is in include and it does not scroll - Martinez Toni
  • And how can parallax not scroll? - Arnis Shaykh
  • What do you have in mind? In include I have CardView. Where do I have a scrolling view in NestedScrollView? - Martinez Toni
  • He scrolls, but podtarmazhivaet, it's not in the photo, because the photo weighs 70kb and the size of 100x100 - Martinez Toni
  • If there is no scrolling view inside the NestedScrollview you do not need to use it at all. Suitable RelativeLayout or LinearLayout . - Arnis Shaykh