Recyclerview list end overlay color and alpha

佐手、 提交于 2019-12-06 10:49:31

The RecyclerView take the shadow from the colorPrimary of your Theme.

You need to create new theme for RecyclerView then apply this Theme to your RecyclerView

In below example themes colorPrimary is colorGreen so it will take green color shadow.

SAMPLE CODE

<android.support.v7.widget.RecyclerView
     android:id="@+id/ha_citiesRC"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_marginTop="10dp"
     android:requiresFadingEdge="vertical"
     android:theme="@style/CustomTheme"
     android:nestedScrollingEnabled="false" />

theme

 <style name="CustomTheme" parent="Theme.AppCompat.Light.DarkActionBar">

   <item name="colorPrimary">@color/colorGreen</item>
   <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
   <item name="colorAccent">@color/colorAccent</item>

 </style>

try this in your RecylerView

  android:overScrollMode="never"

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:background="#000"
android:scrollbars="vertical" />

Change the ColorPrimary for that Activity and Fragment using style Firstly create the style

 <style name="RecyclerView" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">"Enter the Color Which you want"</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

After then just set the style to Activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.RecyclerView);
    setContentView(R.layout.activity_home);
    super.onCreate(savedInstanceState);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!