我如何在Android中创建一个底部切割的半椭圆形按钮?
我正在尝试创建一个半椭圆形按钮,这在模型中很容易,但在XML文件中却很难实现。我还希望涟漪效应仅限于椭圆形。 可能有一种方法可以在shapexml文件中剪切一个椭圆形,但我不知道 我正在努力实现的目标: 但最接近我的是: 使用以下代码:我如何在Android中创建一个底部切割的半椭圆形按钮?,android,xml,button,shapes,Android,Xml,Button,Shapes,我正在尝试创建一个半椭圆形按钮,这在模型中很容易,但在XML文件中却很难实现。我还希望涟漪效应仅限于椭圆形。 可能有一种方法可以在shapexml文件中剪切一个椭圆形,但我不知道 我正在努力实现的目标: 但最接近我的是: 使用以下代码: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#8C9AEE"/>
<size
android:width="120dp"
android:height="60dp"/>
<corners
android:topLeftRadius="140dp"
android:topRightRadius="140dp"/>
</shape>
如有任何建议,将不胜感激。我看到的选项中没有一个达到了预期的效果。请尝试以下代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#8C9AEE" />
<size
android:width="120dp"
android:height="60dp" />
</shape>
或
请参阅以下资源
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#8C9AEE" />
<size
android:width="120dp"
android:height="60dp" />
</shape>
希望你能帮忙