天天看点

Android隐藏Listview和RecyclerView 滑动边界的阴影,去除滚动条加分隔线等

1、Listview的属性设置,虽然我现在经常用RecyclerView,很少用Listview了,但是还是顺便写一下,以便巩固一下知识,万一以后需要呢。

android:overScrollFooter="@android:color/transparent"

android:overScrollHeader="@android:color/transparent"      

看看熟悉不。加上试试吧

//设置滑动到边缘时无效果模式:

android:overScrollMode="never"      

当然设置上面的话也行,下面来看看整体

//以下是整体设置(overScrollHeader和overScrollFooter可不写,此处写了是引用的透明色)

<ListView

android:id="@+id/lv_listview"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:overScrollFooter="@android:color/transparent"

android:overScrollHeader="@android:color/transparent"

android:overScrollMode="never"

>      

再来说说其他属性吧,大家都知道,既然来了再看看

android:divider="#ff0000" 可以是颜色和图片

android:dividerHeight="1px" 要显示分隔线,分隔线的高度必须大于0

android:headerDividersEnabled="true" headview下是否加分隔线

android:footerDividersEnabled="true" footview是否加分隔线

android:scrollbars="none" 设置滚动条不显示,当然ScroollView 也同样有用      

2、RecyclerView的属性设置

<android.support.v7.widget.RecyclerView

android:id="@+id/rv_search_one"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:overScrollMode="never"

android:scrollbars="none" />