【问题标题】:Android Toolbar : shadow on top instead of bottomAndroid工具栏:顶部而不是底部的阴影
【发布时间】:2017-01-17 17:10:52
【问题描述】:

我使用标准的 Android 工具栏 android.support.v7.widget.Toolbar

https://developer.android.com/reference/android/support/v7/widget/Toolbar.html

我想将此工具栏放在屏幕底部 => 我希望阴影位于工具栏的顶部而不是底部。

我该怎么做?

谢谢!

【问题讨论】:

  • 你能提供一个你试过的片码吗?
  • 我的错,我没有看到有一些代码在底部放了一个阴影。没有链接到 Toolbar 类的方法来添加阴影。

标签: java android android-toolbar


【解决方案1】:

您可以在 drawables 文件夹中定义以下渐变

    <shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
    android:startColor="#000"
    android:angle="90"
    />
</shape>

然后在你的布局中使用如下

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="bottom">

        </android.support.v7.widget.Toolbar>

    <View android:background="@drawable/drop_shadow_tab"
        android:layout_width="match_parent"
        android:layout_height="5dp"
        android:layout_gravity="bottom"
        android:layout_marginBottom="50dp"/>

</FrameLayout>

这可能就是你想要的。 :)

【讨论】:

    猜你喜欢
    • 2018-12-27
    • 2016-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多