android - 如何在android中制作椭圆形按钮?

标签 android xml android-layout android-studio android-xml

我有一个在网站上看到的按钮,我想用 xml 重新创建它。但是,我无法获得与它完全匹配的正确尺寸。下面是我到目前为止的代码,但它与形状不完全匹配。希望有人能帮忙!

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid
        android:color="@color/white"></solid>
    <corners
        android:radius="600dp" />
    <padding
        android:left="10dp"
        android:top="10dp"
        android:right="10dp"
        android:bottom="10dp" />
    <stroke
        android:width="3px" android:color="@color/salmon_main"/>
</shape>

enter image description here

最佳答案

This question already asked click there to check

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

  <corners
    android:bottomLeftRadius="30dp"
    android:bottomRightRadius="30dp"
    android:radius="60dp"
    android:topLeftRadius="30dp"
    android:topRightRadius="30dp" />

  <solid android:color="#CFCFCF" />

  <padding
    android:bottom="0dp"
    android:left="0dp"
    android:right="0dp"
    android:top="0dp" />

  <size
    android:height="60dp"
    android:width="270dp" />

</shape>

关于android - 如何在android中制作椭圆形按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42777682/

相关文章:

android - 如何在 Android 中获取存储在 firebase 中的所有图像的 URL?

xml - Xquery 中的分组和计数

java - layout_weight 不起作用

android - 从服务调用接收异步数据时如何更新谷歌眼镜菜单

java - 有没有办法在 JVM 或 Dalvik 的运行时将 CPU 使用率限制为一定百分比?

Android 2.1文件读取速度慢

java - 基于具有自定义逻辑的模板转换 XML。哪个框架?如何实现流媒体播放?

java - 错误 : Invalid content was found starting with element 'X' . 应为 '{X}' 之一

Android CSS布局不会使用全屏宽度

android - 安装错误 : INSTALL_PARSE_FAILED_MANIFEST_MALFORMED? 安装失败