RecyclerView:没有滚动条 [英] RecyclerView: no scrollbar

查看:2938
本文介绍了RecyclerView:没有滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RecyclerView,并希望有滚动条显示,当它涵盖了多个页面。

我得到根本没有滚动条。任何想法?

我的布局:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直>    <复选框
        机器人:ID =@ + ID / cl_only_empty
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:海拔=5DP
        机器人:文字=@字符串/ cl_only_empty
        机器人:文字颜色=@色/白/>    < android.support.v7.widget.RecyclerView
        机器人:ID =@ + ID / callsList
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:滚动条=垂直/>< / LinearLayout中>


解决方案

解决的办法是设置垂直(或水平)滚动条中的XML布局:

 < android.support.v7.widget.RecyclerView
      机器人:layout_width =FILL_PARENT
      机器人:layout_height =FILL_PARENT
      机器人:滚动条=垂直/>

I've got a RecyclerView and would like to have scrollbar showing, when it covers more than one page.

I get no scrollbar at all. Any idea?

My layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <CheckBox
        android:id="@+id/cl_only_empty"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:elevation="5dp"
        android:text="@string/cl_only_empty"
        android:textColor="@color/white" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/callsList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical" />

</LinearLayout>

解决方案

The solution is to set the vertical (or horizontal) scrollbar in the xml layout:

<android.support.v7.widget.RecyclerView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scrollbars="vertical" />

这篇关于RecyclerView:没有滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆