我在nestedscrollview 中有三个recyclerview,我需要第三个继续回收,就像他不在nestedscrollview 中一样。除了缺少回收功能外,一切都很好。
这是我的 xml:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scroll_discovery"
android:fillViewport="true"
android:fitsSystemWindows="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/category_recycler"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/category_recycler"
android:id="@+id/user_recycler"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/user_recycler"
android:id="@+id/experiences"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
这是java部分
experienceRecycler=(RecyclerView)findViewById(R.id.experiences);
experienceRecycler.setHasFixedSize(true);
mLayoutManager =new LinearLayoutManager(this) {
@Override
public boolean canScrollVertically() {
return false;
}
};
page= 1;
experienceRecycler.setLayoutManager(mLayoutManager);
experienceAdapter=new FeedCardAdapter(experiences,this,currentUser);
experienceRecycler.setAdapter(experienceAdapter);
/*experienceRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
feedCardAdapter.setScrolled(true);
}
});*/
categoryRecycler=(RecyclerView)findViewById(R.id.category_recycler);
categoryRecycler.setLayoutManager(new LinearLayoutManager(this){
@Override
public boolean canScrollVertically() {
return false;
}
});
categoryAdapter=new CategoryAdapter(this,categories);
categoryRecycler.setHasFixedSize(true);
categoryRecycler.setAdapter(categoryAdapter);
userRecycler=(RecyclerView)findViewById(R.id.user_recycler);
userRecycler.setLayoutManager(new LinearLayoutManager(this){
@Override
public boolean canScrollVertically() {
return false;
}
});
userAdapter=new UserAdapter(this,users);
userRecycler.setAdapter(userAdapter);
userRecycler.setHasFixedSize(true);