按钮效果实现方法?

图片描述

请问各位那个已签到的按钮是怎么做出来的(背景透明但是外围有一圈不透明的环绕线)。

阅读 3.4k
2 个回答

已经解决了可以通过设置背景shape图片来解决 shape代码如下
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"

android:shape="rectangle">
<corners

android:topLeftRadius="100dp"
android:topRightRadius="100dp"
android:bottomRightRadius="100dp"
android:bottomLeftRadius="100dp">

</corners>
<stroke

android:width="3dp"
android:color="#bebebe">

</stroke>
</shape>

用 shape 画

<?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <solid
        android:color="@android:color/transparent"/>
    <stroke
        android:color="@android:color/darker_gray"
        android:width="1dp"/>
    <corners
        android:radius="20dp"/>
</shape>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题