【发布时间】:2017-04-07 17:53:40
【问题描述】:
我有几个按钮需要椭圆形边框。
所以我在 capsule_border.xml 中有这个
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="9999dp"/>
<stroke
android:width="1px"
android:color="@color/border_gray" />
</shape>
我会在需要的地方使用android:background="@drawable/capsule_border.xml。
现在,我想要一个按钮来拥有这个椭圆形的边框,还有一个android:background="?selectableItemBackground" 用于视觉反馈。
我尝试使用带有 selectableItembackground 的父布局和带有 capsule_border 的按钮。但似乎突出显示的可点击区域是整个正方形。而不仅仅是胶囊边界内的区域。
有没有什么办法可以让 selectableItemBackground 不在视图的整个矩形范围内,而只在我绘制的边框内?
【问题讨论】:
标签: android android-layout android-view android-drawable android-selector