Android 5功能 - 在滑动时自定义屏幕边缘的阴影

时间:2014-12-18 06:00:52

标签: android android-5.0-lollipop

屏幕截图中屏幕底部显示的阴影的技术名称是什么?我似乎无法通过在线搜索找到一个术语。

如果有人读过这个还没有安装Android 5的人,但是对它的功能有点熟悉的话,那么当你无处可去的时候尝试向一个方向滑动时会出现这个阴影(例如,当已经无处可去时向下滑动这个菜单的底部)。

是否可以在自己的应用中更改此阴影的颜色? - 如果是的话,怎么样?

Screenshot

1 个答案:

答案 0 :(得分:1)

根据Brian的评论,我相信改变边缘效果颜色的一种方法是colorPrimarydeveloper guides描述为:

The primary branding color for the app; used as the action bar background, recents task title and in edge effects.

在使用colorPrimary主题时更改Material和其他属性,找到here

另请参阅colorEdgeEffect

Further attributes give fine grained control over colorizing controls, see: colorControlNormal, colorControlActivated, colorControlHighlight, colorButtonNormal, colorSwitchThumbNormal, colorEdgeEffect, statusBarColor and navigationBarColor.

<resources>
  <!-- inherit from the material theme -->
  <style name="AppTheme" parent="android:Theme.Material">
    <!-- Main theme colors -->
    <!--   your app branding color for the app bar -->
    <!--   changing colorPrimary will change the color of the edge effect -->
    <item name="android:colorPrimary">@color/primary</item>
    <!--   darker variant for the status bar and contextual app bars -->
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <!--   theme UI controls like checkboxes and text fields -->
    <item name="android:colorAccent">@color/accent</item>
  </style>
</resources>