android 底部选项卡,android – 如何将底部阴影添加到选项卡布局

嗨,我需要在我的标签布局下添加阴影(如在Skype中).

52c38e15e404187bd1f7cb85d14a389c.png

我的活动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”时,阴影被添加到底部和顶部..我只需要底部.见图片……

a924ac98c7b3b8cec2d762fb636fe178.png

我怎样才能做到这一点 ?

提前致谢.

解决方法:

只需向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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值