开始还以为是TabLayout在高版本系统上的特殊表现呢,没有在意,UI提出说感觉不好看就查了一下,原来是在TabLayout放在AppBarLayout里面才有这样的效果,只需要对AppBarLayout设置一个属性:
app:elevation=”0dp”
<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="0dp"> <android.support.design.widget.TabLayout android:id="@+id/tab" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>