相关疑难解决方法(0)

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

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

shadow_skype

我的活动xml:

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.Toolbar xmlns:local="http://schemas.android.com/apk/res-auto"
        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.support.design.widget.TabLayout
        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" />
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_below="@+id/tab_layout"
        android:id="@+id/tabContainer"
        android:layout_height="match_parent" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

当我添加android:elevation="10dp"到Tablayout时,阴影被添加到底部和顶部..我只需要底部.见图片......

在此输入图像描述

我怎样才能做到这一点 ?提前致谢.

xml android toolbar shadow android-elevation

14
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

android-elevation ×1

shadow ×1

toolbar ×1

xml ×1