嗨,我需要在我的标签布局下添加阴影(如在Skype中).
我的活动xml:
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/splashGreenTop"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
android:id="@+id/tab_layout"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize" />
android:layout_width="match_parent"
android:layout_below="@+id/tab_layout"
android:id="@+id/tabContainer"
android:layout_height="match_parent" />
当我向Tablayout添加android:elevation =“10dp”时,阴影被添加到底部和顶部..我只需要底部.见图片……
我怎样才能做到这一点 ?
提前致谢.
解决方法:
只需向Tablayout添加高程(0dp – 25dp)即可.有关高程的更多信息,请阅读material design指南.
android:elevation="10dp"
编辑:
将它添加到tablayout和工具栏
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/splashGreenTop"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:elevation="10dp" />
android:id="@+id/tab_layout"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:elevation="10dp"/>
标签:android,xml,toolbar,shadow,android-elevation
来源: https://codeday.me/bug/20191002/1843228.html