how to reduce fix shadow effect in recycler-view below item in android












0














enter image description here
this is my image i have used card view to display item in recyclerview view . Below is xml



<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/cardTicketName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="Here will be the text"
android:textColor="#484848"
android:padding="20dp"
android:textSize="15dp" />
</LinearLayout>
</android.support.v7.widget.CardView>


that below item bottom shadow is more than top shadow and also same problem happening when we scroll top item to bottom then shadow increase of bottom and when again scroll to top same item its shadow effect decrees



how to fix this issue?










share|improve this question





























    0














    enter image description here
    this is my image i have used card view to display item in recyclerview view . Below is xml



    <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
    android:id="@+id/cardTicketName"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:gravity="center"
    android:text="Here will be the text"
    android:textColor="#484848"
    android:padding="20dp"
    android:textSize="15dp" />
    </LinearLayout>
    </android.support.v7.widget.CardView>


    that below item bottom shadow is more than top shadow and also same problem happening when we scroll top item to bottom then shadow increase of bottom and when again scroll to top same item its shadow effect decrees



    how to fix this issue?










    share|improve this question



























      0












      0








      0







      enter image description here
      this is my image i have used card view to display item in recyclerview view . Below is xml



      <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical">
      <TextView
      android:id="@+id/cardTicketName"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_gravity="center"
      android:gravity="center"
      android:text="Here will be the text"
      android:textColor="#484848"
      android:padding="20dp"
      android:textSize="15dp" />
      </LinearLayout>
      </android.support.v7.widget.CardView>


      that below item bottom shadow is more than top shadow and also same problem happening when we scroll top item to bottom then shadow increase of bottom and when again scroll to top same item its shadow effect decrees



      how to fix this issue?










      share|improve this question















      enter image description here
      this is my image i have used card view to display item in recyclerview view . Below is xml



      <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical">
      <TextView
      android:id="@+id/cardTicketName"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_gravity="center"
      android:gravity="center"
      android:text="Here will be the text"
      android:textColor="#484848"
      android:padding="20dp"
      android:textSize="15dp" />
      </LinearLayout>
      </android.support.v7.widget.CardView>


      that below item bottom shadow is more than top shadow and also same problem happening when we scroll top item to bottom then shadow increase of bottom and when again scroll to top same item its shadow effect decrees



      how to fix this issue?







      android android-recyclerview






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 at 4:49









      fnascimento

      7811015




      7811015










      asked Nov 22 at 14:45









      Bhaskar Mart

      105




      105
























          3 Answers
          3






          active

          oldest

          votes


















          1














          The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.



          This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.



          There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.



          You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.



          https://material.io/design/environment/light-shadows.html






          share|improve this answer





























            0














            Add card_view:cardElevation="0dp" to your CardView






            share|improve this answer





















            • no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
              – Bhaskar Mart
              Nov 22 at 14:49





















            0














            try this



            to reduce the shadow reduce the cardElevation size.



            <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            card_view:cardElevation="1dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <TextView
            android:id="@+id/cardTicketName"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="Here will be the text"
            android:textColor="#484848"
            android:padding="20dp"
            android:textSize="15dp" />
            </LinearLayout>
            </android.support.v7.widget.CardView>





            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%2f53433378%2fhow-to-reduce-fix-shadow-effect-in-recycler-view-below-item-in-android%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














              The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.



              This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.



              There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.



              You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.



              https://material.io/design/environment/light-shadows.html






              share|improve this answer


























                1














                The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.



                This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.



                There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.



                You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.



                https://material.io/design/environment/light-shadows.html






                share|improve this answer
























                  1












                  1








                  1






                  The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.



                  This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.



                  There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.



                  You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.



                  https://material.io/design/environment/light-shadows.html






                  share|improve this answer












                  The Android framework uses a combination of two simulated light sources to create shadow effects. One of these is a general ambient light, so that everything with elevation casts a little bit of shadow on all sides. The other, however, is a simulated point light near the top of the screen.



                  This point light's position means that bottom shadows are always larger than top shadows. It also means that bottom shadows near the bottom of the screen are always larger than bottom shadows near the top of the screen.



                  There is no way to disable this behavior. If you want to use Android's built-in elevation/shadow framework, this is how it works.



                  You can simulate your own shadows by doing custom drawing or by using a gradient with semi-transparent black, but you will find both of these significantly more difficult than simply accepting that this is how shadows work and this is what users are expecting.



                  https://material.io/design/environment/light-shadows.html







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 22 at 18:17









                  Ben P.

                  22.3k31846




                  22.3k31846

























                      0














                      Add card_view:cardElevation="0dp" to your CardView






                      share|improve this answer





















                      • no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                        – Bhaskar Mart
                        Nov 22 at 14:49


















                      0














                      Add card_view:cardElevation="0dp" to your CardView






                      share|improve this answer





















                      • no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                        – Bhaskar Mart
                        Nov 22 at 14:49
















                      0












                      0








                      0






                      Add card_view:cardElevation="0dp" to your CardView






                      share|improve this answer












                      Add card_view:cardElevation="0dp" to your CardView







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 22 at 14:47









                      Anthony Fillion-Maillet

                      160211




                      160211












                      • no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                        – Bhaskar Mart
                        Nov 22 at 14:49




















                      • no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                        – Bhaskar Mart
                        Nov 22 at 14:49


















                      no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                      – Bhaskar Mart
                      Nov 22 at 14:49






                      no its not working when i use this then shadow effect become remove @Anthony Fillion-Maillet
                      – Bhaskar Mart
                      Nov 22 at 14:49













                      0














                      try this



                      to reduce the shadow reduce the cardElevation size.



                      <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                      xmlns:card_view="http://schemas.android.com/apk/res-auto"
                      card_view:cardElevation="1dp"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content">
                      <LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical">
                      <TextView
                      android:id="@+id/cardTicketName"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:layout_gravity="center"
                      android:gravity="center"
                      android:text="Here will be the text"
                      android:textColor="#484848"
                      android:padding="20dp"
                      android:textSize="15dp" />
                      </LinearLayout>
                      </android.support.v7.widget.CardView>





                      share|improve this answer


























                        0














                        try this



                        to reduce the shadow reduce the cardElevation size.



                        <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                        xmlns:card_view="http://schemas.android.com/apk/res-auto"
                        card_view:cardElevation="1dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <TextView
                        android:id="@+id/cardTicketName"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:text="Here will be the text"
                        android:textColor="#484848"
                        android:padding="20dp"
                        android:textSize="15dp" />
                        </LinearLayout>
                        </android.support.v7.widget.CardView>





                        share|improve this answer
























                          0












                          0








                          0






                          try this



                          to reduce the shadow reduce the cardElevation size.



                          <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                          xmlns:card_view="http://schemas.android.com/apk/res-auto"
                          card_view:cardElevation="1dp"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content">
                          <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical">
                          <TextView
                          android:id="@+id/cardTicketName"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:layout_gravity="center"
                          android:gravity="center"
                          android:text="Here will be the text"
                          android:textColor="#484848"
                          android:padding="20dp"
                          android:textSize="15dp" />
                          </LinearLayout>
                          </android.support.v7.widget.CardView>





                          share|improve this answer












                          try this



                          to reduce the shadow reduce the cardElevation size.



                          <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                          xmlns:card_view="http://schemas.android.com/apk/res-auto"
                          card_view:cardElevation="1dp"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content">
                          <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical">
                          <TextView
                          android:id="@+id/cardTicketName"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:layout_gravity="center"
                          android:gravity="center"
                          android:text="Here will be the text"
                          android:textColor="#484848"
                          android:padding="20dp"
                          android:textSize="15dp" />
                          </LinearLayout>
                          </android.support.v7.widget.CardView>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 22 at 14:50









                          Aniruddh Parihar

                          2,15911027




                          2,15911027






























                              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.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • 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%2f53433378%2fhow-to-reduce-fix-shadow-effect-in-recycler-view-below-item-in-android%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

                              Contact image not getting when fetch all contact list from iPhone by CNContact

                              count number of partitions of a set with n elements into k subsets

                              A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks