安卓 : How to create oval size drawable resouce?

标签 android performance android-layout

我正在尝试创建可绘制资源椭圆形 com 矩形形状?我想要下面的形状 enter image description here

但我得到以下信息:

enter image description here

我在用什么:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle" >

  <gradient
    android:startColor="#36D53D"
    android:centerColor="#36D53D"
    android:endColor="#36D53D"
    android:angle="90"/>
  <padding android:left="3dp"
    android:top="5dp"
    android:right="5dp"
    android:bottom="5dp" />

  <corners android:radius="160dp"></corners>
</shape>

如何创建我想要的形状?提前谢谢你

最佳答案

试试这个椭圆形的。

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >

    <!-- fill/color -->
    <solid
        android:color="#ff0000"/>

    <!-- Control the width and height of the shape -->
    <size
        android:width="120dp"
        android:height="70dp"/>
</shape>

圆角矩形

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

    <!-- fill/color -->
    <solid
        android:color="#ff0000"/>

    <!-- Control the width and height of the shape -->
    <size
        android:width="200dp"
        android:height="70dp"/>

    <!-- Control the radius of each corners -->
    <corners
        android:topLeftRadius="30dp"
        android:topRightRadius="15dp"
        android:bottomLeftRadius="15dp"
        android:bottomRightRadius="15dp"/>
</shape>

关于安卓 : How to create oval size drawable resouce?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29676847/

相关文章:

java - 还有其他方法可以使用监听器在单击按钮时调用方法吗?

Android 应用程序从后台服务定时弹出

java - 为什么 Epoxy 不生成模型类?

wordpress - Nginx Fastcgi_cache性能——磁盘缓存VS tmpfs缓存VS静态文件

c# - 堆叠使用语句与单独使用语句

java - 如何强制android为支持的屏幕尺寸选择正确的布局?

android - 无法聚焦 EditText

Android:数据库导出适用于模拟器,不适用于手机

angularjs - 如何在相同条件下为 ng-show 减少 AngularJS 中的观察者

java - 如何在小部件中添加垂直滚动条?