Android: I cannot remove elevation / shadow on my toolbar

前端 未结 10 2286
名媛妹妹
名媛妹妹 2020-12-08 01:57

Hi i would like to remove the elevation and shadow effect from my toolbar for API 21 and greater. Below is what i have tried

setSupportActionBar(mToolbar);
          


        
10条回答
  •  情歌与酒
    2020-12-08 02:47

    This remove elevation on toolbar (android:stateListAnimator="@null"), stateListAnimator is for API level 21 or higher, so insert a tools prop (before namespace declaration) like this:

    //xmlns:tools="http://schemas.android.com/tools" in parent or start element
    
         
    
     
    
        
    
    //your content goes here like RecyclerView, Card or other layout 
    

    Here is my sample result:

提交回复
热议问题