如何逐渐隐藏 Recyclerview 滚动条上的项目
How to hide Items on recyclerview scrollbar gradually
如何逐渐隐藏 recyclerview 滚动条上的项目
我要这样图片
工具栏
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/posts_toolbar"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp">
<com.salah250.forvo.Funcations.TextViewFont
android:id="@+id/txt_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/posts_title"
android:textColor="@color/posts_title"
android:textSize="18dp" />
</android.support.v7.widget.Toolbar>
Activity 帖子
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/posts_main"
android:orientation="vertical"
tools:context=".Posts.PostsActivity">
<include layout="@layout/toolbar_posts" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_posts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</LinearLayout>
我还没来得及post就在这里看了,我根本找不到任何谈论它的话题,我希望能得到一些想法。
你可以在你的RecyclerView
前面放上渐变图
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/posts_main"
android:orientation="vertical"
tools:context=".Posts.PostsActivity">
<include layout="@layout/toolbar_posts" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_posts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:src="@drawable/gradient"/>
<FrameLayout/>
</LinearLayout>
@drawable/gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#00FFFFFF"
android:startColor="#302e43" />
</shape>
然后将具有渐变高度的空白视图添加到 RecyclerView
的 header,这样最上面的项目就不会褪色
如何逐渐隐藏 recyclerview 滚动条上的项目
我要这样图片
工具栏
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/posts_toolbar"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp">
<com.salah250.forvo.Funcations.TextViewFont
android:id="@+id/txt_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/posts_title"
android:textColor="@color/posts_title"
android:textSize="18dp" />
</android.support.v7.widget.Toolbar>
Activity 帖子
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/posts_main"
android:orientation="vertical"
tools:context=".Posts.PostsActivity">
<include layout="@layout/toolbar_posts" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_posts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</LinearLayout>
我还没来得及post就在这里看了,我根本找不到任何谈论它的话题,我希望能得到一些想法。
你可以在你的RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/posts_main"
android:orientation="vertical"
tools:context=".Posts.PostsActivity">
<include layout="@layout/toolbar_posts" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_posts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:src="@drawable/gradient"/>
<FrameLayout/>
</LinearLayout>
@drawable/gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#00FFFFFF"
android:startColor="#302e43" />
</shape>
然后将具有渐变高度的空白视图添加到 RecyclerView
的 header,这样最上面的项目就不会褪色