How to show part of next/previous card RecyclerView : <p>What is the best strategy to achieve this feature:</p>

<p><a href="https://i.stack.imgur.com/IKaKq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IKaKq.png" alt="enter image description here"></a></p>

<p>I Have a horizontal RecyclerView with cards.
Each card will fulfil the entire screen, but I want it to show part of the next card and previous one if it has more than one item.</p>

<p>I know I can achieve this by setting my card <code>android:layout_width</code> at the adapter to have a specific DP like 250dp instead of <code>match_parent</code>. 
But it doesn't look like a proper solution.</p>

<p>This is my code:</p>

<p>Activity with RecyclerView:</p>

<pre><code>    class ListPokemon : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val items = createListPokemons()
        recyclerView.adapter = PokemonAdapter(items)
        recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
        recyclerView.setHasFixedSize(true)
        val pagerSnapHelper = PagerSnapHelper()
        pagerSnapHelper.attachToRecyclerView(recyclerView)
    }

    private fun createListPokemons(): List&lt;Pokemon&gt; {
        val pokemons = ArrayList&lt;Pokemon&gt;()
        pokemons += createPokemon("Pikachu")
        pokemons += createPokemon("Bulbasaur")
        pokemons += createPokemon("Charmander")
        pokemons += createPokemon("Squirtle")

        return pokemons
    }

    private fun createPokemon(name: String) = Pokemon(name = name, height = 1, weight = 69, id = 1)
}
</code></pre>

<p>Layout of Activity:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.constraint.ConstraintLayout
    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"
    tools:context=".MainActivity"&gt;

    &lt;android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layoutManager="android.support.v7.widget.LinearLayoutManager"/&gt;

&lt;/android.support.constraint.ConstraintLayout&gt;
</code></pre>

<p>Adapter:</p>

<pre><code>class PokemonAdapter(val list: List&lt;Pokemon&gt;) : RecyclerView.Adapter&lt;PokemonAdapter.PokemonVH&gt;() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PokemonAdapter.PokemonVH {
        return PokemonVH(LayoutInflater.from(parent.context)
            .inflate(R.layout.pokemon_item, parent, false))
    }

    override fun onBindViewHolder(holder: PokemonAdapter.PokemonVH, position: Int) {
        holder.textViewName.text = list[position].name
    }

    override fun getItemCount(): Int {
        return list.size
    }

    class PokemonVH(itemView: View) : RecyclerView.ViewHolder(itemView) {

        var textViewName: TextView = itemView.findViewById(R.id.textViewName)
    }
}
</code></pre>

<p>Layout of Adapter:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.v7.widget.CardView
    android:layout_gravity="center_horizontal"
    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="wrap_content"
    android:layout_marginStart="16dp"
    android:layout_marginEnd="16dp"
    app:cardCornerRadius="8dp"
    app:cardElevation="4dp"&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"&gt;

        &lt;TextView
            android:padding="36dp"
            android:id="@+id/textViewName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textSize="22sp"
            tools:text="Teste String"/&gt;

    &lt;/LinearLayout&gt;

&lt;/android.support.v7.widget.CardView&gt;
</code></pre>

<p>This is my result:</p>

<p><a href="https://i.stack.imgur.com/7D9XB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7D9XB.png" alt="enter image description here"></a></p>

<p>I would like to show part of the next card at this situation. How can I do this?</p>

<p>Thanks.</p>
