Remove the shadow below TabLayout on android

后端 未结 4 761
栀梦
栀梦 2021-02-19 11:21

I\'m trying to remove the shadow below tabs while using TabLayout, which is defined in a normal layout (and not as a part of a toolbar or actionbar).

Setting theme as

相关标签:
4条回答
  • 2021-02-19 11:43

    I'm assuming your TabLayout is inside AppBarLayout, that shadow comes with AppBarLayout, add this app:elevation="0dp" to that widget and I believe you're good to go.

    0 讨论(0)
  • 2021-02-19 11:43

    Put getSupportActionBar().setElevation(0); in MainActivity java file like this:

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        getSupportActionBar().setElevation(0);
    
    0 讨论(0)
  • 2021-02-19 11:46

    I try app:elevation="0dp" work and android:elevation="0dp" does not work in AppBarLayout

    0 讨论(0)
  • 2021-02-19 11:55

    I had to set the elevation to 0dp and I also change the theme of AppBarLayout to @style/Base.Widget.Design.TabLayout and it worked for me

    0 讨论(0)
提交回复
热议问题