Sto utilizzando un NestedScrollView in un layout e sto tentando di utilizzare il nuovo CoordinatorLayout dalla libreria di supporto alla progettazione per CollapsingToolbarLayout.Lo scorrimento non funziona in NestedScrollView quando si prova a scorrere da visualizzazioni con eventi click
mio file di layout si presenta così:
<?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:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
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="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!-- app:expandedTitleMarginEnd="64dp"-->
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="@drawable/image_load_default_big" />
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollVw"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
android:fitsSystemWindows="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/changePasswordButtonContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/changePasswordExpand"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/back_img"
android:text="Change Your Password"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/changePasswordContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/changePasswordButtonContainer"
android:layout_centerInParent="true"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Edit Your Password"
android:textColor="@color/orange" />
<EditText
android:id="@+id/etUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/edittext_default_bg"
android:drawableLeft="@drawable/password_icon"
android:drawableRight="@drawable/tick"
android:hint=" Old Password"
android:padding="12dp"
android:password="true"
android:textColorHint="#b5b5b5" />
<EditText
android:id="@+id/etPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/edittext_default_bg"
android:drawableLeft="@drawable/password_icon"
android:drawableRight="@drawable/cross"
android:hint=" New Password"
android:padding="12dp"
android:password="true"
android:textColorHint="#b5b5b5" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:paddingTop="20dp"
android:text="show password" />
<Button
android:id="@+id/btnSingIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/login_button_background"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="Done"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/dealerToDealerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/changePasswordContainer"
android:orientation="vertical">
<Button
android:id="@+id/dealerToDealerExpand"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/back_img"
android:text="Dealer To Dealer Platform No"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dealerToDealerContainer"
android:layout_centerInParent="true"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Edit Number"
android:textColor="@color/orange" />
<EditText
android:id="@+id/dealerToDealerNo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/edittext_default_bg"
android:drawableLeft="@drawable/password_icon"
android:drawableRight="@drawable/tick"
android:hint=" 56546789"
android:padding="12dp"
android:password="true"
android:textColorHint="#b5b5b5" />
<Button
android:id="@+id/dealerToDealerNoDone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/login_button_background"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="Done"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Quando provo a scorrere, a volte non funziona. motivo per questo, altri elementi di layout con eventi di clic stanno consumando l'evento tocco. Fondamentalmente EditText, RadioButton, Button stanno consumando eventi touch. Qualche suggerimento per risolvere questo problema?
Hai risolto lo scorrimento con le viste selezionabili all'interno? Hai marcato risolto con 'fill_vertical' ma per me riempie solo lo spazio vuoto. Ancora non scorre con le viste cliccabili. – Davidea
fill_vertical non ha risolto il problema, sembra che il problema sia con CollapsingToolbar, perché se rimuoviamo CollapsingToolbar ha iniziato a funzionare correttamente. – bhai
Con 22.2.1, sembra risolto, puoi confermare? – Davidea