Android 回收器视图项目没有滚动?

Android 回收器视图项目没有滚动?,android,android-layout,android-recyclerview,nestedrecyclerview,Android,Android Layout,Android Recyclerview,Nestedrecyclerview,我正在处理Recycler视图,在这里我将三个Recycler视图水平放置在一个布局中。问题是第二个和第三个Recycler视图项目显示,但无法滚动,即使使用嵌套的滚动内部和附加的xml。请建议我如何滚动第二个和第三个Recycler视图 <RelativeLayout android:id="@+id/layout_bottom_sheet" android:layout_width="match_parent" android:layout_height="22

我正在处理Recycler视图,在这里我将三个Recycler视图水平放置在一个布局中。问题是第二个和第三个Recycler视图项目显示,但无法滚动,即使使用嵌套的滚动内部和附加的xml。请建议我如何滚动第二个和第三个Recycler视图

<RelativeLayout
    android:id="@+id/layout_bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="220dp"
    android:background="@color/color_bottom_sheet"
    android:elevation="@dimen/z_bottom_sheet"
    app:behavior_hideable="true"
    app:behavior_peekHeight="80dp"
    app:layout_behavior="@string/string_bottom_sheet_behavior">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rightLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
        <LinearLayout
            android:id="@+id/lay1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#ff0000">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerViewmonth"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </LinearLayout>
        <android.support.v4.widget.NestedScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fillViewport="true"
            android:verticalScrollbarPosition="right">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <LinearLayout
                    android:id="@+id/lay2"
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="#00ff00">
                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/recyclerViewdate"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
                </LinearLayout>
            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>
        <LinearLayout
            android:id="@+id/lay3"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#0000ff">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerViewyear"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </LinearLayout>
    </LinearLayout>
    <TextView
        android:id="@+id/text_view_sheet_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="@dimen/activity_vertical_margin"
        android:text="@string/text_pull_to_show_more"
        android:textSize="@dimen/text_size_medium"
        android:visibility="gone" />
    <TextView
        android:id="@+id/text_view_more_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/text_view_sheet_title"
        android:paddingLeft="@dimen/activity_vertical_margin"
        android:paddingRight="@dimen/activity_vertical_margin"
        android:text="@string/text_more_contet_to_user"
        android:textSize="@dimen/text_size_big"
        android:textStyle="bold"
        android:visibility="gone" />
    <Button
        android:id="@+id/btnclick"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/text_view_more_content"
        android:layout_marginLeft="@dimen/activity_vertical_margin"
        android:layout_marginRight="@dimen/activity_vertical_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:text="@string/text_click_me"
        android:visibility="gone" />
</RelativeLayout>

//爪哇

@Override
   protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerViewmonth);
   RecyclerView recyclerdate = (RecyclerView) findViewById(R.id.recyclerViewdate);
   RecyclerView recycleryear = (RecyclerView) findViewById(R.id.recyclerViewyear);
   ButterKnife.bind(this);
   LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
   LinearLayoutManager linearLayoutManagerdate = new LinearLayoutManager(getApplicationContext());
   LinearLayoutManager linearLayoutManageryear = new LinearLayoutManager(getApplicationContext());

   recyclerView.setLayoutManager(linearLayoutManager);
   recyclerdate.setLayoutManager(linearLayoutManagerdate);
   recycleryear.setLayoutManager(linearLayoutManageryear);

   recyclerView.setNestedScrollingEnabled(false);
   recyclerdate.setNestedScrollingEnabled(false);
   recycleryear.setNestedScrollingEnabled(false);

   for (int i = 0; i <= 31; i++) {
       dayList.add(String.valueOf(i));
   }
   CustomAdapter customAdapter = new CustomAdapter(MainActivity.this, monthList);
   recyclerView.setAdapter(customAdapter);


   DayAdapter dayAdapter=new DayAdapter(MainActivity.this,dayList);
   recyclerdate.setNestedScrollingEnabled(false);
   recyclerdate.setAdapter(dayAdapter);
   recyclerdate.setNestedScrollingEnabled(false);

   YearAdapter yearAdapter=new YearAdapter(MainActivity.this,monthList);
   recycleryear.setAdapter(yearAdapter);
@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerView RecyclerView=(RecyclerView)findViewById(R.id.recyclerViewmonth);
RecyclerView recyclerdate=(RecyclerView)findViewById(R.id.RecyclerWebDate);
RecyclerView recycleryear=(RecyclerView)findViewById(R.id.RecyclerViewEyear);
把(这个)绑起来;
LinearLayoutManager LinearLayoutManager=新的LinearLayoutManager(getApplicationContext());
LinearLayoutManager linearLayoutManagerdate=新的LinearLayoutManager(getApplicationContext());
LinearLayoutManager linearLayoutManageryear=新的LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerdate.setLayoutManager(linearLayoutManagerdate);
setLayoutManager(linearLayoutManageryear);
recyclerView.setNestedScrollingEnabled(false);
recyclerdate.setNestedScrollingEnabled(false);
recycleryear.setNestedScrollingEnabled(false);

对于(int i=0;i将java代码也张贴在初始化回收器视图的位置。此外,尝试从嵌套滚动视图中删除回收器视图(可以在没有嵌套滚动视图的情况下放置它们)



将所有回收器视图保留在嵌套的滚动视图中。

更改父级布局高度以匹配父级。如

<RelativeLayout
    android:id="@+id/layout_bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/color_bottom_sheet"
    android:elevation="@dimen/z_bottom_sheet"
    app:behavior_hideable="true"
    app:behavior_peekHeight="80dp"
    app:layout_behavior="@string/string_bottom_sheet_behavior">


</RelativeLayout>


在您的
回收视图中使用
android:nestedScrollingEnabled=“false”
@Nilesh Rathod RecyclerView。setNestedScrollingEnabled(false);不可用working@Rajakumar测试用例
ViewCompat.setNestedScrollingEnabled(recyclerView,false);
@NileshRathod根据她的代码,我将您下面的代码设置为recycleryear.setNestedScrollingEnabled(false);ViewCompat.setNestedScrollingEnabled(recyclerdate,false);不滚动每个部分需要单独滚动如果您希望每个回收器视图显示完整数据,则“是”将起作用,否则为回收器视图定义特定高度也将起作用。在这两种情况下,您必须将所有回收器视图保留在嵌套滚动视图中。@Tarun Kumar需要单独滚动每个部分YY@Rajakumar,当回收器视图放置在不同的线性布局中时,它们会独立滚动。您不需要将它们包装在嵌套滚动视图中。在右侧布局中,权重总和:3,布局1,2,3,布局权重:1,这样它们将以相等的空间水平排列,是@Manohari,删除嵌套滚动视图和c见鬼。@TarunKumar谢谢你的回复。.在实施你的建议后,我面临的问题是lay2 recyclerview没有滚动。我不知道这有什么问题,第三个recycler视图呢?现在滚动了吗?还要检查日志。是否有任何异常。
<RelativeLayout
    android:id="@+id/layout_bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/color_bottom_sheet"
    android:elevation="@dimen/z_bottom_sheet"
    app:behavior_hideable="true"
    app:behavior_peekHeight="80dp"
    app:layout_behavior="@string/string_bottom_sheet_behavior">


</RelativeLayout>