Add dividers and ripple effect for each GridLayout square












-1















I am using RecyclerView + GridLayout (3 columns). Now to make each square of the grid more "responsive", I want that each square will show some sort of divider, and that there will be a ripple effect within each square that the user clicks.



Edit : I added android:foreground="?attr/selectableItemBackground", but nothing happens.This is the single item xml code right now:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip" >

<ImageView
android:foreground="?attr/selectableItemBackground"
android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="118dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:contentDescription="TODO"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>


This is how it currently look:
NoRippleDivider



And this is how I want it to look:
enter image description here



This is how it works currently after fix, after adding:



android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"


enter image description here










share|improve this question

























  • in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

    – Aniruddh Parihar
    Nov 20 '18 at 8:58











  • Yes! You're right, thank you

    – Fireio
    Nov 20 '18 at 9:08
















-1















I am using RecyclerView + GridLayout (3 columns). Now to make each square of the grid more "responsive", I want that each square will show some sort of divider, and that there will be a ripple effect within each square that the user clicks.



Edit : I added android:foreground="?attr/selectableItemBackground", but nothing happens.This is the single item xml code right now:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip" >

<ImageView
android:foreground="?attr/selectableItemBackground"
android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="118dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:contentDescription="TODO"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>


This is how it currently look:
NoRippleDivider



And this is how I want it to look:
enter image description here



This is how it works currently after fix, after adding:



android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"


enter image description here










share|improve this question

























  • in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

    – Aniruddh Parihar
    Nov 20 '18 at 8:58











  • Yes! You're right, thank you

    – Fireio
    Nov 20 '18 at 9:08














-1












-1








-1








I am using RecyclerView + GridLayout (3 columns). Now to make each square of the grid more "responsive", I want that each square will show some sort of divider, and that there will be a ripple effect within each square that the user clicks.



Edit : I added android:foreground="?attr/selectableItemBackground", but nothing happens.This is the single item xml code right now:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip" >

<ImageView
android:foreground="?attr/selectableItemBackground"
android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="118dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:contentDescription="TODO"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>


This is how it currently look:
NoRippleDivider



And this is how I want it to look:
enter image description here



This is how it works currently after fix, after adding:



android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"


enter image description here










share|improve this question
















I am using RecyclerView + GridLayout (3 columns). Now to make each square of the grid more "responsive", I want that each square will show some sort of divider, and that there will be a ripple effect within each square that the user clicks.



Edit : I added android:foreground="?attr/selectableItemBackground", but nothing happens.This is the single item xml code right now:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip" >

<ImageView
android:foreground="?attr/selectableItemBackground"
android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="118dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:contentDescription="TODO"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>


This is how it currently look:
NoRippleDivider



And this is how I want it to look:
enter image description here



This is how it works currently after fix, after adding:



android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"


enter image description here







android android-recyclerview rippledrawable






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 9:04







Fireio

















asked Nov 19 '18 at 20:33









FireioFireio

527




527













  • in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

    – Aniruddh Parihar
    Nov 20 '18 at 8:58











  • Yes! You're right, thank you

    – Fireio
    Nov 20 '18 at 9:08



















  • in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

    – Aniruddh Parihar
    Nov 20 '18 at 8:58











  • Yes! You're right, thank you

    – Fireio
    Nov 20 '18 at 9:08

















in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

– Aniruddh Parihar
Nov 20 '18 at 8:58





in place of android:foreground="?attr/selectableItemBackground" at imageView use android:background="?attr/selectableItemBackground" in RelativeLayout and set android:clickable="true".

– Aniruddh Parihar
Nov 20 '18 at 8:58













Yes! You're right, thank you

– Fireio
Nov 20 '18 at 9:08





Yes! You're right, thank you

– Fireio
Nov 20 '18 at 9:08












3 Answers
3






active

oldest

votes


















1














you can create a ripple drawable like this if you want it to be customize:



ripple.xml



<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorPrimaryDark">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimaryLight" />
<!--<corners android:radius="@dimen/button_radius_large" />-->
</shape>
</item>

<item android:id="@android:id/background">
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="@color/background"
android:startColor="@color/background"
android:type="linear" />
<!--<corners android:radius="10dp" />-->
</shape>
</item>




and use it in your layout like this:



android:clickable="true"
android:background="@drawable/ripple"


OR
you can simply do it like this:



android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"





share|improve this answer
























  • thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

    – Fireio
    Nov 20 '18 at 9:04











  • its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

    – LeojAngelico
    Nov 20 '18 at 9:17



















0














You can add divider by adding a GridItemDecoration to your recyclerview. i suggest you to use this.



a simple way for adding ripple when you click on items is adding a foreground with selectableItemBackground value to your item's view:



android:foreground="?attr/selectableItemBackground"





share|improve this answer
























  • I added my xml for single item, including the code you provided, yet nothing happens

    – Fireio
    Nov 20 '18 at 8:38











  • please add setOnClickListener for your item and check it again

    – Reza.Abedini
    Nov 20 '18 at 8:45











  • @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

    – Reza.Abedini
    Nov 20 '18 at 8:55



















0















try this way for Ripple Effect in xml




<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">

<ImageView

android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="118dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:contentDescription="TODO"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>


and follow this link for Dividers in between items
How to add dividers and spaces between items in RecyclerView?






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382222%2fadd-dividers-and-ripple-effect-for-each-gridlayout-square%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    you can create a ripple drawable like this if you want it to be customize:



    ripple.xml



    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimaryDark">
    <item android:id="@android:id/mask">
    <shape android:shape="rectangle">
    <solid android:color="@color/colorPrimaryLight" />
    <!--<corners android:radius="@dimen/button_radius_large" />-->
    </shape>
    </item>

    <item android:id="@android:id/background">
    <shape android:shape="rectangle">
    <gradient
    android:angle="90"
    android:endColor="@color/background"
    android:startColor="@color/background"
    android:type="linear" />
    <!--<corners android:radius="10dp" />-->
    </shape>
    </item>




    and use it in your layout like this:



    android:clickable="true"
    android:background="@drawable/ripple"


    OR
    you can simply do it like this:



    android:clickable="true"
    android:focusable="true"
    android:foreground="?attr/selectableItemBackground"





    share|improve this answer
























    • thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

      – Fireio
      Nov 20 '18 at 9:04











    • its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

      – LeojAngelico
      Nov 20 '18 at 9:17
















    1














    you can create a ripple drawable like this if you want it to be customize:



    ripple.xml



    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimaryDark">
    <item android:id="@android:id/mask">
    <shape android:shape="rectangle">
    <solid android:color="@color/colorPrimaryLight" />
    <!--<corners android:radius="@dimen/button_radius_large" />-->
    </shape>
    </item>

    <item android:id="@android:id/background">
    <shape android:shape="rectangle">
    <gradient
    android:angle="90"
    android:endColor="@color/background"
    android:startColor="@color/background"
    android:type="linear" />
    <!--<corners android:radius="10dp" />-->
    </shape>
    </item>




    and use it in your layout like this:



    android:clickable="true"
    android:background="@drawable/ripple"


    OR
    you can simply do it like this:



    android:clickable="true"
    android:focusable="true"
    android:foreground="?attr/selectableItemBackground"





    share|improve this answer
























    • thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

      – Fireio
      Nov 20 '18 at 9:04











    • its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

      – LeojAngelico
      Nov 20 '18 at 9:17














    1












    1








    1







    you can create a ripple drawable like this if you want it to be customize:



    ripple.xml



    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimaryDark">
    <item android:id="@android:id/mask">
    <shape android:shape="rectangle">
    <solid android:color="@color/colorPrimaryLight" />
    <!--<corners android:radius="@dimen/button_radius_large" />-->
    </shape>
    </item>

    <item android:id="@android:id/background">
    <shape android:shape="rectangle">
    <gradient
    android:angle="90"
    android:endColor="@color/background"
    android:startColor="@color/background"
    android:type="linear" />
    <!--<corners android:radius="10dp" />-->
    </shape>
    </item>




    and use it in your layout like this:



    android:clickable="true"
    android:background="@drawable/ripple"


    OR
    you can simply do it like this:



    android:clickable="true"
    android:focusable="true"
    android:foreground="?attr/selectableItemBackground"





    share|improve this answer













    you can create a ripple drawable like this if you want it to be customize:



    ripple.xml



    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimaryDark">
    <item android:id="@android:id/mask">
    <shape android:shape="rectangle">
    <solid android:color="@color/colorPrimaryLight" />
    <!--<corners android:radius="@dimen/button_radius_large" />-->
    </shape>
    </item>

    <item android:id="@android:id/background">
    <shape android:shape="rectangle">
    <gradient
    android:angle="90"
    android:endColor="@color/background"
    android:startColor="@color/background"
    android:type="linear" />
    <!--<corners android:radius="10dp" />-->
    </shape>
    </item>




    and use it in your layout like this:



    android:clickable="true"
    android:background="@drawable/ripple"


    OR
    you can simply do it like this:



    android:clickable="true"
    android:focusable="true"
    android:foreground="?attr/selectableItemBackground"






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 20 '18 at 8:52









    LeojAngelicoLeojAngelico

    283




    283













    • thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

      – Fireio
      Nov 20 '18 at 9:04











    • its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

      – LeojAngelico
      Nov 20 '18 at 9:17



















    • thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

      – Fireio
      Nov 20 '18 at 9:04











    • its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

      – LeojAngelico
      Nov 20 '18 at 9:17

















    thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

    – Fireio
    Nov 20 '18 at 9:04





    thank you! that did the job, sort of, I added a new picture to the bottom of the original post, showing you that the ripple works, but it only does a rectangle. Is it possible to somehow fill the "square" around the image?

    – Fireio
    Nov 20 '18 at 9:04













    its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

    – LeojAngelico
    Nov 20 '18 at 9:17





    its not possible unless you add another layout which is directly on top of your parent layout where your imageview is located then add the ripple effect on that layout. do it with relative layout. this is just a suggestion :)

    – LeojAngelico
    Nov 20 '18 at 9:17













    0














    You can add divider by adding a GridItemDecoration to your recyclerview. i suggest you to use this.



    a simple way for adding ripple when you click on items is adding a foreground with selectableItemBackground value to your item's view:



    android:foreground="?attr/selectableItemBackground"





    share|improve this answer
























    • I added my xml for single item, including the code you provided, yet nothing happens

      – Fireio
      Nov 20 '18 at 8:38











    • please add setOnClickListener for your item and check it again

      – Reza.Abedini
      Nov 20 '18 at 8:45











    • @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

      – Reza.Abedini
      Nov 20 '18 at 8:55
















    0














    You can add divider by adding a GridItemDecoration to your recyclerview. i suggest you to use this.



    a simple way for adding ripple when you click on items is adding a foreground with selectableItemBackground value to your item's view:



    android:foreground="?attr/selectableItemBackground"





    share|improve this answer
























    • I added my xml for single item, including the code you provided, yet nothing happens

      – Fireio
      Nov 20 '18 at 8:38











    • please add setOnClickListener for your item and check it again

      – Reza.Abedini
      Nov 20 '18 at 8:45











    • @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

      – Reza.Abedini
      Nov 20 '18 at 8:55














    0












    0








    0







    You can add divider by adding a GridItemDecoration to your recyclerview. i suggest you to use this.



    a simple way for adding ripple when you click on items is adding a foreground with selectableItemBackground value to your item's view:



    android:foreground="?attr/selectableItemBackground"





    share|improve this answer













    You can add divider by adding a GridItemDecoration to your recyclerview. i suggest you to use this.



    a simple way for adding ripple when you click on items is adding a foreground with selectableItemBackground value to your item's view:



    android:foreground="?attr/selectableItemBackground"






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 19 '18 at 20:42









    Reza.AbediniReza.Abedini

    1,039813




    1,039813













    • I added my xml for single item, including the code you provided, yet nothing happens

      – Fireio
      Nov 20 '18 at 8:38











    • please add setOnClickListener for your item and check it again

      – Reza.Abedini
      Nov 20 '18 at 8:45











    • @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

      – Reza.Abedini
      Nov 20 '18 at 8:55



















    • I added my xml for single item, including the code you provided, yet nothing happens

      – Fireio
      Nov 20 '18 at 8:38











    • please add setOnClickListener for your item and check it again

      – Reza.Abedini
      Nov 20 '18 at 8:45











    • @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

      – Reza.Abedini
      Nov 20 '18 at 8:55

















    I added my xml for single item, including the code you provided, yet nothing happens

    – Fireio
    Nov 20 '18 at 8:38





    I added my xml for single item, including the code you provided, yet nothing happens

    – Fireio
    Nov 20 '18 at 8:38













    please add setOnClickListener for your item and check it again

    – Reza.Abedini
    Nov 20 '18 at 8:45





    please add setOnClickListener for your item and check it again

    – Reza.Abedini
    Nov 20 '18 at 8:45













    @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

    – Reza.Abedini
    Nov 20 '18 at 8:55





    @Fireio or you can add android:clickable="true" android:focusable="true" to your item.

    – Reza.Abedini
    Nov 20 '18 at 8:55











    0















    try this way for Ripple Effect in xml




    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="6dip"
    android:clickable="true"
    android:focusable="true"
    android:background="?attr/selectableItemBackground">

    <ImageView

    android:id="@+id/icon"
    android:layout_width="128dp"
    android:layout_height="118dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginStart="12dp"
    android:layout_marginEnd="12dp"
    android:layout_marginTop="12dp"
    android:contentDescription="TODO"
    android:src="@drawable/ic_launcher_background" />
    </RelativeLayout>


    and follow this link for Dividers in between items
    How to add dividers and spaces between items in RecyclerView?






    share|improve this answer




























      0















      try this way for Ripple Effect in xml




      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:padding="6dip"
      android:clickable="true"
      android:focusable="true"
      android:background="?attr/selectableItemBackground">

      <ImageView

      android:id="@+id/icon"
      android:layout_width="128dp"
      android:layout_height="118dp"
      android:layout_alignParentStart="true"
      android:layout_alignParentTop="true"
      android:layout_marginStart="12dp"
      android:layout_marginEnd="12dp"
      android:layout_marginTop="12dp"
      android:contentDescription="TODO"
      android:src="@drawable/ic_launcher_background" />
      </RelativeLayout>


      and follow this link for Dividers in between items
      How to add dividers and spaces between items in RecyclerView?






      share|improve this answer


























        0












        0








        0








        try this way for Ripple Effect in xml




        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="6dip"
        android:clickable="true"
        android:focusable="true"
        android:background="?attr/selectableItemBackground">

        <ImageView

        android:id="@+id/icon"
        android:layout_width="128dp"
        android:layout_height="118dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"
        android:layout_marginTop="12dp"
        android:contentDescription="TODO"
        android:src="@drawable/ic_launcher_background" />
        </RelativeLayout>


        and follow this link for Dividers in between items
        How to add dividers and spaces between items in RecyclerView?






        share|improve this answer














        try this way for Ripple Effect in xml




        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="6dip"
        android:clickable="true"
        android:focusable="true"
        android:background="?attr/selectableItemBackground">

        <ImageView

        android:id="@+id/icon"
        android:layout_width="128dp"
        android:layout_height="118dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"
        android:layout_marginTop="12dp"
        android:contentDescription="TODO"
        android:src="@drawable/ic_launcher_background" />
        </RelativeLayout>


        and follow this link for Dividers in between items
        How to add dividers and spaces between items in RecyclerView?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 9:11









        Aniruddh PariharAniruddh Parihar

        2,17911027




        2,17911027






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382222%2fadd-dividers-and-ripple-effect-for-each-gridlayout-square%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents