天天看點

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" />