如上所示,当我从'Foliage Plants'滚动时,CollapsibleToolbar会按预期折叠,但是当我从任何产品图像拖动时,页面会在AppBarLayout下方滚动。为什么会发生这种情况以及如何解决这个问题?我曾尝试将VerticalRecyclerView.setNestedScrolling设置为false,但这不起作用。
位于ViewPager
内的片段结构主页布局
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_productoverview"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/windowBackground"/>
ViewPager内部片段的布局如下
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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="wrap_content">
<android.support.constraint.ConstraintLayout
android:id="@+id/layout_section_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#ccc"
android:paddingBottom="10dp"
android:paddingTop="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<experttag.nurserylive.util.ui.widget.WhitneySemiBoldTextView
android:id="@+id/textview_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="0dp"
android:text="TOP FEATURED"
android:textColor="#000"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/imageview_item_viewall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:tint="#000"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="@drawable/ic_arrow_forward_black_24dp"/>
</android.support.constraint.ConstraintLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_item_section"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_section_header"/>
</android.support.constraint.ConstraintLayout>
@ id / recyclerview_productoverview
内的项目布局public void accept(long invitationId, String username) {
Invitation invitation = this.loadById(invitationId);
User user = userService.loadByUsername(username);
validateAccessToInvitation(invitation, user);
Group group = invitation.getGroup();
group.addMember(user);
invitationRepository.delete(invitation);
// groupRepository.save(group);
}
答案 0 :(得分:0)
setNestedScrollingEnabled(false)为我解决了这个问题。