Как постепенно скрывать элементы на панели прокрутки - PullRequest
0 голосов
/ 10 октября 2018

Как я могу постепенно скрывать элементы на полосе прокрутки в окне реселлера

Я хочу вот так Изображение

enter image description here

Панель инструментов

<?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>

Активность Сообщений

<?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>

Я смотрел прежде, чем я мог написать здесь, и я не мог найти ни одной темы, о которой говорилэто вообще, я надеюсь получить некоторые идеи для этого.

1 Ответ

0 голосов
/ 10 октября 2018

Вы можете поместить градиентное изображение перед вашим 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 поэтому самый верхний элемент не будет выцветать

...