You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何移除Android ActionBar底部边框?已解决:修改Activity主题

Fix for Persistent Android ActionBar Bottom Border

It sounds like you hit a common gotcha when trying to remove the ActionBar's bottom border/shadow—let’s walk through the solution that worked for you, since it’s easy to mix up which theme controls this element:

First, you mentioned two methods that didn’t work at first:

  • Calling setElevation(0) programmatically
  • Adding <item name="android:windowContentOverlay">@null</item> to your ActionBar-specific theme

The root issue was misidentifying where the border is styled: it’s not part of the ActionBar’s theme, but your Activity’s theme.

The Working Fix

To eliminate the bottom border, you need to add the windowContentOverlay attribute to your Activity’s style definition (not the nested ActionBar theme):

<!-- For AppCompat-based themes -->
<item name="windowContentOverlay">@null</item>

<!-- For older Android themes using the android namespace -->
<item name="android:windowContentOverlay">@null</item>

Once you apply this change to your Activity’s theme, the bottom border will disappear completely. This works because the shadow/border is actually drawn by the window content overlay tied to the Activity, not the ActionBar itself.

内容的提问来源于stack exchange,提问作者JMR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:34:36