//在drawable下创建文件.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#66CC00" />
<size
android:width="200dp"
android:height="200dp" />
</shape><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fffefe" />
<corners android:radius="10dp" />
<padding
android:bottom="20dp"
android:left="20dp"
android:right="20dp"
android:top="20dp" />
</shape>
本文通过两个XML示例介绍了如何在Android中使用shape元素来定义圆形和带圆角的矩形。第一个示例展示了如何设置一个绿色的圆形,而第二个示例则详细解释了如何创建一个白色背景、四角圆滑且带有内外边距的矩形。
1741

被折叠的 条评论
为什么被折叠?



