如何删除按钮阴影(android)

新手上路,请多包涵

我想从按钮上移除阴影,使其看起来更平坦。

我现在有这个:

带阴影的取消按钮

但我想要这个:

没有阴影的取消按钮

原文由 sousheel 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 536
2 个回答

另一种选择是添加

style="?android:attr/borderlessButtonStyle"

到您的 Button xml,如此处 所述 http://developer.android.com/guide/topics/ui/controls/button.html

一个例子是

<Button
android:id="@+id/button_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:onClick="sendMessage"
style="?android:attr/borderlessButtonStyle" />

原文由 Alt-Cat 发布,翻译遵循 CC BY-SA 3.0 许可协议

它需要 API 级别 21

         android:outlineProvider="none"

原文由 Ronald Saunfe 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题