画圆点

255 阅读1分钟

一、使用shape

在Android中可以使用shape来绘制一个圆形。创建一个XML文件,用于定义shape样式。

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

    <!-- 设置圆形的颜色为红色 -->
    <solid android:color="#3170DF" />
    <!-- 设置圆形的宽度为30dp -->
    <!-- 设置圆形的高度为30dp -->
    <size
        android:width="30dp"
        android:height="30dp" />

</shape>